-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0b2b43
commit 4133596
Showing
21 changed files
with
1,042 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-java-client-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-elasticsearch-java-client-deployment</artifactId> | ||
<name>Quarkus - Elasticsearch Java client - Deployment</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-rest-client-common-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-rest-client-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-java-client</artifactId> | ||
<version>999-SNAPSHOT</version><!-- FIXME --> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc-deployment</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-jackson-deployment</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
|
||
</project> |
21 changes: 21 additions & 0 deletions
21
...java/io/quarkus/elasticsearch/javaclient/deployment/ElasticsearchJavaClientProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package io.quarkus.elasticsearch.javaclient.deployment; | ||
|
||
import io.quarkus.arc.deployment.AdditionalBeanBuildItem; | ||
import io.quarkus.deployment.Feature; | ||
import io.quarkus.deployment.annotations.BuildStep; | ||
import io.quarkus.deployment.builditem.FeatureBuildItem; | ||
import io.quarkus.elasticsearch.javaclient.runtime.ElasticsearchJavaClientProducer; | ||
|
||
class ElasticsearchJavaClientProcessor { | ||
|
||
@BuildStep | ||
FeatureBuildItem feature() { | ||
return new FeatureBuildItem(Feature.ELASTICSEARCH_JAVA_CLIENT); | ||
} | ||
|
||
@BuildStep() | ||
AdditionalBeanBuildItem build() { | ||
return AdditionalBeanBuildItem.unremovableOf(ElasticsearchJavaClientProducer.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>quarkus-extensions-parent</artifactId> | ||
<groupId>io.quarkus</groupId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-elasticsearch-java-client-parent</artifactId> | ||
<name>Quarkus - Elasticsearch Java client - Parent</name> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>runtime</module> | ||
<module>deployment</module> | ||
</modules> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-java-client-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-elasticsearch-java-client</artifactId> | ||
<name>Quarkus - Elasticsearch Java client - Runtime</name> | ||
<description>Connect to an Elasticsearch cluster using the Java client</description> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-rest-client-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-elasticsearch-rest-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-jackson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jboss.logmanager</groupId> | ||
<artifactId>log4j2-jboss-logmanager</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>co.elastic.clients</groupId> | ||
<artifactId>elasticsearch-java</artifactId> | ||
<version>7.16.1</version> <!-- FIXME --> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bootstrap-maven-plugin</artifactId> | ||
<configuration> | ||
<capabilities> | ||
<provides>io.quarkus.elasticsearch-rest-high-level-client</provides> | ||
</capabilities> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<annotationProcessorPaths> | ||
<path> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-extension-processor</artifactId> | ||
<version>${project.version}</version> | ||
</path> | ||
</annotationProcessorPaths> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
68 changes: 68 additions & 0 deletions
68
...ain/java/io/quarkus/elasticsearch/javaclient/runtime/ElasticsearchJavaClientProducer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package io.quarkus.elasticsearch.javaclient.runtime; | ||
|
||
import java.io.IOException; | ||
import java.io.UncheckedIOException; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.annotation.PreDestroy; | ||
import javax.enterprise.context.ApplicationScoped; | ||
import javax.enterprise.inject.Default; | ||
import javax.enterprise.inject.Produces; | ||
import javax.inject.Inject; | ||
import javax.inject.Singleton; | ||
|
||
import org.elasticsearch.client.RestClient; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import co.elastic.clients.elasticsearch.ElasticsearchAsyncClient; | ||
import co.elastic.clients.elasticsearch.ElasticsearchClient; | ||
import co.elastic.clients.json.jackson.JacksonJsonpMapper; | ||
import co.elastic.clients.transport.ElasticsearchTransport; | ||
import co.elastic.clients.transport.rest_client.RestClientTransport; | ||
|
||
@ApplicationScoped | ||
public class ElasticsearchJavaClientProducer { | ||
|
||
@Inject | ||
@Default | ||
RestClient restClient; | ||
|
||
@Inject | ||
ObjectMapper objectMapper; | ||
|
||
private ElasticsearchClient client; | ||
private ElasticsearchAsyncClient asyncClient; | ||
private ElasticsearchTransport transport; | ||
|
||
@PostConstruct | ||
void initTransport() { | ||
this.transport = new RestClientTransport(restClient, new JacksonJsonpMapper(objectMapper)); | ||
} | ||
|
||
@Produces | ||
@Singleton | ||
public ElasticsearchClient blockingClient() { | ||
this.client = new ElasticsearchClient(this.transport); | ||
return this.client; | ||
} | ||
|
||
@Produces | ||
@Singleton | ||
public ElasticsearchAsyncClient asyncClient() { | ||
this.asyncClient = new ElasticsearchAsyncClient(this.transport); | ||
return this.asyncClient; | ||
} | ||
|
||
@PreDestroy | ||
void destroy() { | ||
try { | ||
if (this.transport != null) { | ||
this.transport.close(); | ||
} | ||
} catch (IOException ioe) { | ||
throw new UncheckedIOException(ioe); | ||
} | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...ions/elasticsearch-java-client/runtime/src/main/resources/META-INF/quarkus-extension.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
artifact: ${project.groupId}:${project.artifactId}:${project.version} | ||
name: "ElasticsearchJava Client" | ||
metadata: | ||
keywords: | ||
- "elasticsearch" | ||
- "full text" | ||
- "search" | ||
guide: "https://quarkus.io/guides/elasticsearch" | ||
categories: | ||
- "data" | ||
status: "preview" | ||
config: | ||
- "quarkus.elasticsearch." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Eclipse | ||
.project | ||
.classpath | ||
.settings/ | ||
bin/ | ||
|
||
# IntelliJ | ||
.idea | ||
*.ipr | ||
*.iml | ||
*.iws | ||
|
||
# NetBeans | ||
nb-configuration.xml | ||
|
||
# Visual Studio Code | ||
.vscode | ||
|
||
# OSX | ||
.DS_Store | ||
|
||
# Vim | ||
*.swp | ||
*.swo | ||
|
||
# patch | ||
*.orig | ||
*.rej | ||
|
||
# Maven | ||
target/ | ||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
release.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# quarkus-integration-test-elasticsearch-java-client project | ||
|
||
This project uses Quarkus, the Supersonic Subatomic Java Framework. | ||
|
||
If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ . | ||
|
||
## Running the application in dev mode | ||
|
||
You can run your application in dev mode that enables live coding using: | ||
``` | ||
./mvnw quarkus:dev | ||
``` | ||
|
||
## Packaging and running the application | ||
|
||
The application can be packaged using `./mvnw package`. | ||
It produces the `quarkus-integration-test-elasticsearch-java-client-1.0-SNAPSHOT-runner.jar` file in the `/target` directory. | ||
Be aware that it’s not an _über-jar_ as the dependencies are copied into the `target/lib` directory. | ||
|
||
The application is now runnable using `java -jar target/quarkus-integration-test-elasticsearch-java-client-1.0-SNAPSHOT-runner.jar`. | ||
|
||
## Creating a native executable | ||
|
||
You can create a native executable using: `./mvnw package -Pnative`. | ||
|
||
Or, if you don't have GraalVM installed, you can run the native executable build in a container using: `./mvnw package -Pnative -Dquarkus.native.container-build=true`. | ||
|
||
You can then execute your native executable with: `./target/quarkus-integration-test-elasticsearch-java-client-1.0-SNAPSHOT-runner` | ||
|
||
If you want to learn more about building native executables, please consult https://quarkus.io/guides/building-native-image-guide. |
Oops, something went wrong.