Kategorie: Tech & Trends
Blog
Kafka - Die Verwandlung
...class WateringKafkaEndpoint { //... ...
...WateringKafkaEndpoint { //... ...
... //... @Incoming("habarama-in") ...
... //... @Incoming("habarama-in") ...
... @Incoming("habarama-in") public void ...
... @Incoming("habarama-in") public void onMessage(String ...
...onMessage(String message) { ...
...message) { ...
...{ ...
... //...
...
... //... ...
... //... ...
... //... }
} Jedes mal, ...
... //... }
} Jedes mal, wenn ...
Anzeigen
Blog
Schreibst du User Stories oder tust du nur so?
Anzeigen
Blog
How to ride a camel through clouds
...Integration Patterns (EIPs) . It comes ...
...extends RouteBuilder { @Override public ...
...{ @Override public void configure() ...
...throws Exception { ...
...Exception { ...
...{ from("timer:java?period=1000")
...
... from("timer:java?period=1000") ...
... from("timer:java?period=1000") ...
... from("timer:java?period=1000") ...
... from("timer:java?period=1000") ...
...from("timer:java?period=1000") ...
... ...
... .setHeader("example")
...
... .setHeader("example") ...
... .setHeader("example") ...
... .setHeader("example") ...
... .setHeader("example") ...
....setHeader("example") ...
... ...
... ...
... ...
... .constant("Java")
...
... .constant("Java") ...
... .constant("Java") ...
... .constant("Java") ...
... .constant("Java") ...
....constant("Java") ...
... ...
... .setBody()
...
... .setBody() ...
... .setBody() ...
... .setBody() ...
... .setBody() ...
....setBody() ...
... ...
... ...
... ...
... .simple("Hello ...
... .simple("Hello World! ...
... .simple("Hello World! Camel ...
...written in ${header.example}.") ...
...in ${header.example}.") ...
...${header.example}.") ...
... ...
... .to("log:info");
...
... .to("log:info"); ...
... .to("log:info"); ...
... .to("log:info"); ...
... .to("log:info"); ...
....to("log:info"); ...
... ...
... }
} Assuming ...
... }
} Assuming the project ...
...the correct messages Scenario: Integration basic ...
...prints Hello World Given ...
...Hello World Given Camel-K ...
...World Given Camel-K integration ...
...basic is running Then ...
...is running Then Camel-K ...
...running Then Camel-K integration ...
...this:
apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata: name: twitter-search-source ...
... name: twitter-search-source labels: ...
...twitter-search-source labels: camel.apache.org/kamelet.type: ...
... labels: camel.apache.org/kamelet.type: "source"
spec:
...
...labels: camel.apache.org/kamelet.type: "source"
spec: ...
... camel.apache.org/kamelet.type: "source"
spec: definition: ...
..."source"
spec: definition: title: ...
... definition: title: "Timer"
...
...definition: title: "Timer" ...
... title: "Timer" description: ...
...title: "Timer" description: "Produces ...
..."Timer" description: "Produces periodic ...
...a custom payload" required:
...
...custom payload" required: ...
...payload" required: ...
... required: ...
... required: ...
...required: - ...
... - message
...
... - message ...
... - message properties:
...
...- message properties: ...
...message properties: ...
... properties: ...
... properties: ...
...properties: period:
...
... period: ...
... period: ...
... period: ...
... period: ...
...period: ...
... ...
... title: ...
... title: Period
...
... title: Period ...
... title: Period ...
...title: Period ...
...Period ...
... ...
... description: ...
... description: The ...
... description: The time ...
...between two events ...
...two events ...
...events ...
... ...
... type: ...
... type: integer
...
... type: integer ...
... type: integer ...
...type: integer ...
...integer ...
... ...
... default: ...
... default: 1000
...
... default: 1000 ...
... default: 1000 ...
...default: 1000 ...
...1000 message:
...
... message: ...
... message: ...
... message: ...
... message: ...
...message: ...
... ...
... title: ...
... title: Message
...
... title: Message ...
... title: Message ...
...title: Message ...
...Message ...
... ...
... description: ...
... description: The ...
... description: The message ...
...message to generate ...
...to generate ...
...generate ...
... ...
... type: ...
... type: string
...
... type: string ...
... type: string types: ...
...string types: out:
...
... types: out: ...
...types: out: ...
... out: ...
... out: ...
...out: mediaType: ...
... mediaType: text/plain
...
... mediaType: text/plain ...
... mediaType: text/plain flow: ...
...text/plain flow: from:
...
... flow: from: ...
...flow: from: ...
... from: ...
... from: ...
...from: uri: ...
... uri: timer:tick
...
... uri: timer:tick ...
... uri: timer:tick ...
...uri: timer:tick ...
...timer:tick parameters:
...
... parameters: ...
... parameters: ...
... parameters: ...
... parameters: ...
...parameters: ...
... ...
... period: ...
... period: "{{period}}"
...
... period: "{{period}}" ...
... period: "{{period}}" ...
...period: "{{period}}" ...
..."{{period}}" steps:
...
... steps: ...
... steps: ...
... steps: ...
... steps: ...
...steps: ...
... ...
... - ...
... - set-body:
...
... - set-body: ...
... - set-body: ...
...- set-body: ...
...set-body: ...
... ...
... ...
... ...
... ...
... ...
... constant: ...
... constant: "{{message}}"
...
... constant: "{{message}}" ...
... constant: "{{message}}" ...
...constant: "{{message}}" ...
..."{{message}}" ...
... ...
... - ...
... - to: ...
... - to: "kamelet:sink" Example ...
Anzeigen
Blog
Anzeigen
Blog
Anzeigen
Blog
Anzeigen
Blog
Anzeigen
Blog
Anzeigen
Blog
Third Step - JEE Microservices with MicroProfile-Rest-Client
...as JBoss modules.
<dependency> ...
...JBoss modules.
<dependency> ...
...modules.
<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>org.eclipse.microprofile.config</groupId>
...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
...<groupId>org.eclipse.microprofile.config</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-rest-client-api</artifactId>
...
... <artifactId>microprofile-rest-client-api</artifactId> ...
... <artifactId>microprofile-rest-client-api</artifactId> ...
... <artifactId>microprofile-rest-client-api</artifactId> ...
... <artifactId>microprofile-rest-client-api</artifactId> ...
...<artifactId>microprofile-rest-client-api</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.microprofile.rest.client}</version>
...
... <version>${version.microprofile.rest.client}</version> ...
... <version>${version.microprofile.rest.client}</version> ...
... <version>${version.microprofile.rest.client}</version> ...
... <version>${version.microprofile.rest.client}</version> ...
...<version>${version.microprofile.rest.client}</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>org.eclipse.microprofile.config</groupId>
...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
...<groupId>org.eclipse.microprofile.config</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-config-api</artifactId>
...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
...<artifactId>microprofile-config-api</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.microprofile.config}</version>
...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
...<version>${version.microprofile.config}</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> Integration ...
... </dependency> Integration with ...
... </dependency> Integration with Thorntail ...
...MicroProfile-Rest-Client and MicroProfile-Config.
<dependencyManagement> ...
...and MicroProfile-Config.
<dependencyManagement> ...
...MicroProfile-Config.
<dependencyManagement> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <dependencies>
...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>bom</artifactId>
...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
...<artifactId>bom</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.thorntail}</version>
...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
...<version>${version.thorntail}</version> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... </dependencies>
...
... </dependencies> ...
... </dependencies> ...
... </dependencies> ...
... </dependencies> ...
...</dependencies> ...
... ...
... ...
... ...
... ...
... ...
... </dependencyManagement> ...
... </dependencyManagement> ...
... </dependencyManagement> ...
... </dependencyManagement> ...
... </dependencyManagement> ...
...</dependencyManagement> ...
... ...
... ...
... ...
... ...
... ...
... <dependencies>
...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-config</artifactId>
...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
...<artifactId>microprofile-config</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-restclient</artifactId>
...
... <artifactId>microprofile-restclient</artifactId> ...
... <artifactId>microprofile-restclient</artifactId> ...
... <artifactId>microprofile-restclient</artifactId> ...
... <artifactId>microprofile-restclient</artifactId> ...
...<artifactId>microprofile-restclient</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... ...
... ...
... ...
... ...
... </dependencies> Integration ...
... </dependencies> Integration with ...
... </dependencies> Integration with Quarkus ...
...specific Quarkus version.
<dependencyManagement> ...
...Quarkus version.
<dependencyManagement> ...
...version.
<dependencyManagement> ...
... ...
... <dependencies>
...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-bom</artifactId>
...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
...<artifactId>quarkus-bom</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <version>${quarkus.version}</version>
...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
...<version>${quarkus.version}</version> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... ...
... ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... </dependencies>
...
... </dependencies> ...
... </dependencies> ...
... </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> ...
...</dependencies> </dependencyManagement> ...
... </dependencyManagement> <dependencies> ...
... </dependencyManagement> <dependencies> ...
... <dependencies> ...
... <dependencies> <!-- ...
...<dependencies> <!-- MicroProfile-Config ...
... <!-- MicroProfile-Config is ...
...of configuring ...
...configuring ...
... ...
... ...
... ...
... ...
... Quarkus, ...
... Quarkus, so ...
... Quarkus, so there ...
...a dependency --> ...
...dependency --> ...
...--> ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-rest-client</artifactId>
...
... <artifactId>quarkus-rest-client</artifactId> ...
... <artifactId>quarkus-rest-client</artifactId> ...
... <artifactId>quarkus-rest-client</artifactId> ...
... <artifactId>quarkus-rest-client</artifactId> ...
...<artifactId>quarkus-rest-client</artifactId> ...
... ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> </dependencies> How to ...
... </dependency> </dependencies> How to implement ...
...####################################################
@RegisterRestClient(configKey = "restClient")
@RegisterClientHeaders(ClientHeaders.class)
@RegisterProviders({ ...
...= "restClient")
@RegisterClientHeaders(ClientHeaders.class)
@RegisterProviders({ ...
..."restClient")
@RegisterClientHeaders(ClientHeaders.class)
@RegisterProviders({ ...
... ...
... @RegisterProvider(Provider.class)
})
// ...
... @RegisterProvider(Provider.class)
})
// ####################################################
@Path("/")
public ...
... @RegisterProvider(Provider.class)
})
// ####################################################
@Path("/")
public interface ...
...interface ExternalRestResource { @Path("/get")
...
...ExternalRestResource { @Path("/get") ...
...{ @Path("/get") ...
... @Path("/get") @GET
...
... @Path("/get") @GET ...
...@Path("/get") @GET ...
... @GET @Produces(MediaType.APPLICATION_JSON)
...
... @GET @Produces(MediaType.APPLICATION_JSON) ...
...@GET @Produces(MediaType.APPLICATION_JSON) ...
... @Produces(MediaType.APPLICATION_JSON) String ...
... @Produces(MediaType.APPLICATION_JSON) String get();
} The ...
...@Produces(MediaType.APPLICATION_JSON) String get();
} The following ...
...implements ClientHeadersFactory { @Override
...
...ClientHeadersFactory { @Override ...
...{ @Override ...
... @Override public ...
... @Override public MultivaluedMap<String, ...
...@Override public MultivaluedMap<String, String> ...
...MultivaluedMap<String, String> ...
...String> ...
... ...
... update(MultivaluedMap<String, ...
... update(MultivaluedMap<String, String> ...
... update(MultivaluedMap<String, String> incomingHeaders,
...
...update(MultivaluedMap<String, String> incomingHeaders, ...
...String> incomingHeaders, ...
...incomingHeaders, ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... MultivaluedMap<String, ...
... MultivaluedMap<String, String> ...
... MultivaluedMap<String, String> clientOutgoingHeaders) ...
...String> clientOutgoingHeaders) { ...
...clientOutgoingHeaders) { ...
...{ ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... // ...
... // Will ...
... // Will be ...
...with outgoing headers ...
...outgoing headers ...
...headers ...
... ...
... return ...
... return new ...
... return new MultivaluedHashMap<>() ...
...new MultivaluedHashMap<>() {{ ...
...MultivaluedHashMap<>() {{ ...
...{{ ...
... ...
... ...
... ...
... ...
... ...
... put("X-Test", ...
... put("X-Test", Collections.singletonList("test ...
... put("X-Test", Collections.singletonList("test header"));
...
...put("X-Test", Collections.singletonList("test header")); ...
...Collections.singletonList("test header")); ...
...header")); ...
... ...
... }};
...
... }}; ...
... }}; ...
... }}; }
} This ...
... }}; }
} This implementation ...
...}}; }
} This implementation has ...
...the @RegisterClientHeaders annotation.
<dependencyManagement> <dependencies> ...
...annotation.
<dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-bom</artifactId>
...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
...<artifactId>quarkus-bom</artifactId> ...
... ...
... ...
... ...
... ...
... <version>${quarkus.version}</version>
...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
...<version>${quarkus.version}</version> ...
... ...
... ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> </dependencies> ...
... </dependency> </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> <dependencies>
...
...</dependencies> </dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... <!-- ...
... <!-- Does ...
... <!-- Does not ...
...dependency defined. ...
...defined. ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... It ...
... It uses ...
... It uses Smallrye ...
...implementation of ...
...of ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... the ...
... the MicroProfile-Config ...
... the MicroProfile-Config as ...
...as default ...
...default ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... for ...
... for configurations ...
... for configurations -->
...
...for configurations --> </dependencies> ExceptionMapping
MicroProfile-Rest-Client provides the ...
...RestClientExceptionMapper implements ...
...implements ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ResponseExceptionMapper<RuntimeException> ...
... ResponseExceptionMapper<RuntimeException> { ...
... ResponseExceptionMapper<RuntimeException> { ...
... ResponseExceptionMapper<RuntimeException> { @Override
...
...ResponseExceptionMapper<RuntimeException> { @Override ...
...{ @Override ...
... @Override public ...
... @Override public RuntimeException ...
...@Override public RuntimeException toThrowable(Response ...
...toThrowable(Response response) { ...
...response) { ...
...{ ...
... ...
... return ...
... return new ...
... return new RuntimeException(“Error ...
...occurred ” ...
...” ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... + ...
... + response.getStatus());
...
... + response.getStatus()); ...
... + response.getStatus()); }
} There ...
...+ response.getStatus()); }
} There are ...
...response.getStatus()); }
} There are two ...
...interface ExternalRestResource { ...
} @RequestScoped
public ...
...ExternalRestResource { ...
} @RequestScoped
public class ...
...{ ...
} @RequestScoped
public class CDIBean ...
...class CDIBean { @Inject
...
...CDIBean { @Inject ...
...{ @Inject ...
... @Inject @RestClient
...
... @Inject @RestClient ...
...@Inject @RestClient ...
... @RestClient ExternalRestResource ...
... @RestClient ExternalRestResource externalRestResource;
} RestClientBuilder
If ...
...@RestClient ExternalRestResource externalRestResource;
} RestClientBuilder
If dynamic ...
...CDI Producer method.
RestClientBuilder.newBuilder() ...
...Producer method.
RestClientBuilder.newBuilder() ...
...method.
RestClientBuilder.newBuilder() ...
... ...
... ...
... ...
... .baseUri(new ...
... .baseUri(new URI(baseUrl))
...
... .baseUri(new URI(baseUrl)) ...
... .baseUri(new URI(baseUrl)) ...
....baseUri(new URI(baseUrl)) ...
...URI(baseUrl)) ...
... ...
... ...
... ...
... .readTimeout(connectTimeout, ...
... .readTimeout(connectTimeout, TimeUnit.SECONDS)
...
... .readTimeout(connectTimeout, TimeUnit.SECONDS) ...
... .readTimeout(connectTimeout, TimeUnit.SECONDS) ...
....readTimeout(connectTimeout, TimeUnit.SECONDS) ...
...TimeUnit.SECONDS) ...
... ...
... ...
... ...
... .connectTimeout(connectTimeout, ...
... .connectTimeout(connectTimeout, TimeUnit.SECONDS)
...
... .connectTimeout(connectTimeout, TimeUnit.SECONDS) ...
... .connectTimeout(connectTimeout, TimeUnit.SECONDS) ...
....connectTimeout(connectTimeout, TimeUnit.SECONDS) ...
...TimeUnit.SECONDS) ...
... ...
... ...
... ...
... .register(ClientTracingFeature.class)
...
... .register(ClientTracingFeature.class) ...
... .register(ClientTracingFeature.class) ...
... .register(ClientTracingFeature.class) ...
... .register(ClientTracingFeature.class) ...
....register(ClientTracingFeature.class) ...
... ...
... ...
... ...
... .build(ExternalRestResource.class); It ...
... .build(ExternalRestResource.class); It is ...
... .build(ExternalRestResource.class); It is fairly ...
Anzeigen
Blog
Second Step - JEE Microservices with MicroProfile-Opentracing
...rest clients --> ...
...clients --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>org.eclipse.microprofile.config</groupId>
...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
...<groupId>org.eclipse.microprofile.config</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-rest-client-api</artifactId>
...
... <artifactId>microprofile-rest-client-api</artifactId> ...
... <artifactId>microprofile-rest-client-api</artifactId> ...
... <artifactId>microprofile-rest-client-api</artifactId> ...
... <artifactId>microprofile-rest-client-api</artifactId> ...
...<artifactId>microprofile-rest-client-api</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.microprofile.rest.client}</version>
...
... <version>${version.microprofile.rest.client}</version> ...
... <version>${version.microprofile.rest.client}</version> ...
... <version>${version.microprofile.rest.client}</version> ...
... <version>${version.microprofile.rest.client}</version> ...
...<version>${version.microprofile.rest.client}</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... <!-- ...
... <!-- Because ...
... <!-- Because MicroProfile-Rest-Client ...
...MicroProfile-Rest-Client is ...
...is ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... configured ...
... configured via ...
... configured via MicroProfile-Config ...
...via MicroProfile-Config --> ...
...MicroProfile-Config --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>org.eclipse.microprofile.config</groupId>
...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
...<groupId>org.eclipse.microprofile.config</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-config-api</artifactId>
...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
...<artifactId>microprofile-config-api</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.microprofile.config}</version>
...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
...<version>${version.microprofile.config}</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... <!-- ...
... <!-- Provides ...
... <!-- Provides an ...
...custom server ...
...server ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... and ...
... and client ...
... and client side ...
...side tracing (SpanDecorators). ...
...tracing (SpanDecorators). ...
...(SpanDecorators). ...
... ...
... ...
... ...
... ...
... ...
... ...
... WIldfly ...
... WIldfly Module ...
... WIldfly Module will ...
...during runtime --> ...
...runtime --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.opentracing.contrib</groupId>
...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
...<groupId>io.opentracing.contrib</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>opentracing-jaxrs2</artifactId>
...
... <artifactId>opentracing-jaxrs2</artifactId> ...
... <artifactId>opentracing-jaxrs2</artifactId> ...
... <artifactId>opentracing-jaxrs2</artifactId> ...
... <artifactId>opentracing-jaxrs2</artifactId> ...
...<artifactId>opentracing-jaxrs2</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>0.4.1</version>
...
... <version>0.4.1</version> ...
... <version>0.4.1</version> ...
... <version>0.4.1</version> ...
... <version>0.4.1</version> ...
...<version>0.4.1</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... <!-- ...
... <!-- Provides ...
... <!-- Provides an ...
...provides our ...
...our ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... Tracer ...
... Tracer to ...
... Tracer to the ...
...application and subsystem. ...
...and subsystem. ...
...subsystem. ...
... ...
... ...
... ...
... ...
... ...
... ...
... WIldfly ...
... WIldfly Module ...
... WIldfly Module will ...
...during runtime --> ...
...runtime --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.opentracing.contrib</groupId>
...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
...<groupId>io.opentracing.contrib</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>opentracing-tracerresolver</artifactId>
...
... <artifactId>opentracing-tracerresolver</artifactId> ...
... <artifactId>opentracing-tracerresolver</artifactId> ...
... <artifactId>opentracing-tracerresolver</artifactId> ...
... <artifactId>opentracing-tracerresolver</artifactId> ...
...<artifactId>opentracing-tracerresolver</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>0.1.8</version>
...
... <version>0.1.8</version> ...
... <version>0.1.8</version> ...
... <version>0.1.8</version> ...
... <version>0.1.8</version> ...
...<version>0.1.8</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> ...
... ...
... <!-- ...
... <!-- The ...
... <!-- The opentracing ...
...opentracing api --> ...
...api --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... <groupId>org.eclipse.microprofile.config</groupId>
...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
...<groupId>org.eclipse.microprofile.config</groupId> ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>microprofile-opentracing-api</artifactId>
...
... <artifactId>microprofile-opentracing-api</artifactId> ...
... <artifactId>microprofile-opentracing-api</artifactId> ...
... <artifactId>microprofile-opentracing-api</artifactId> ...
... <artifactId>microprofile-opentracing-api</artifactId> ...
...<artifactId>microprofile-opentracing-api</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.microprofile.opentracing}</version>
...
... <version>${version.microprofile.opentracing}</version> ...
... <version>${version.microprofile.opentracing}</version> ...
... <version>${version.microprofile.opentracing}</version> ...
... <version>${version.microprofile.opentracing}</version> ...
...<version>${version.microprofile.opentracing}</version> ...
... ...
... ...
... ...
... ...
... ...
... <scope>provided</scope>
...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
... <scope>provided</scope> ...
...<scope>provided</scope> ...
... ...
... </dependency> Integration ...
... </dependency> Integration with ...
... </dependency> Integration with Thorntail
Thorntail ...
...fraction for MicroProfile-Config.
<dependencyManagement> ...
...for MicroProfile-Config.
<dependencyManagement> ...
...MicroProfile-Config.
<dependencyManagement> <dependencies>
...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>bom</artifactId>
...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
...<artifactId>bom</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.thorntail}</version>
...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
...<version>${version.thorntail}</version> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> </dependencies>
...
... </dependencies> ...
... </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> <dependencies>
...
...</dependencies> </dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... <artifactId>microprofile-config</artifactId>
...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
...<artifactId>microprofile-config</artifactId> </dependency>
...
... </dependency> ...
... </dependency> </dependencies> Configuration
Getting ...
... </dependency> </dependencies> Configuration
Getting Opentracing to ...
...api.
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure> <deployment>
...
...version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure> <deployment> ...
...encoding="UTF-8"?>
<jboss-deployment-structure> <deployment> ...
... <deployment> ...
... <deployment> ...
...<deployment> ...
... ...
... <dependencies>
...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... ...
... ...
... <!-- ...
... <!-- Because ...
... <!-- Because we ...
...the Tracer --> ...
...Tracer --> ...
...--> ...
... ...
... ...
... ...
... ...
... ...
... <module ...
... <module name="io.jaegertracing.jaeger" ...
... <module name="io.jaegertracing.jaeger" />
...
...<module name="io.jaegertracing.jaeger" /> ...
...name="io.jaegertracing.jaeger" /> ...
.../> ...
... ...
... ...
... ...
... ...
... ...
... <!-- ...
... <!-- Contains ...
... <!-- Contains api ...
...for SpanDecorators --> ...
...SpanDecorators --> ...
...--> ...
... ...
... ...
... ...
... ...
... ...
... <module ...
... <module name="io.opentracing.contrib.opentracing-jaxrs2"/>
...
... <module name="io.opentracing.contrib.opentracing-jaxrs2"/> ...
... <module name="io.opentracing.contrib.opentracing-jaxrs2"/> ...
...<module name="io.opentracing.contrib.opentracing-jaxrs2"/> ...
...name="io.opentracing.contrib.opentracing-jaxrs2"/> ...
... ...
... </dependencies>
...
... </dependencies> ...
... </dependencies> ...
... </dependencies> </deployment>
</jboss-deployment-structure> ...
... </dependencies> </deployment>
</jboss-deployment-structure> TracerFactory ...
...</dependencies> </deployment>
</jboss-deployment-structure> TracerFactory discovered ...
...and registered in ...
...registered in ...
...in ...
... ...
... ...
... ...
... ...
... META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory
...
... META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory ...
... META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory ...
... META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory ...
... META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory at.ihet.samples.microprofile.opentracing.TracerFactory Create ...
...
META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory at.ihet.samples.microprofile.opentracing.TracerFactory Create Tracer ...
... at.ihet.samples.microprofile.opentracing.TracerFactory Create Tracer from ...
...
io.opentracing.contrib.tracerresolver.TracerFactory { @Override
...
...io.opentracing.contrib.tracerresolver.TracerFactory { @Override ...
...{ @Override ...
... @Override public ...
... @Override public Tracer ...
...@Override public Tracer getTracer() ...
...Tracer getTracer() { ...
...getTracer() { ...
...{ ...
... ...
... Configuration ...
... Configuration configuration ...
... Configuration configuration = ...
...configuration = Configuration.fromEnv(); ...
...= Configuration.fromEnv(); ...
...Configuration.fromEnv(); ...
... ...
... Tracer ...
... Tracer tracer ...
... Tracer tracer = ...
...tracer = configuration.getTracer(); ...
...= configuration.getTracer(); ...
...configuration.getTracer(); ...
... ...
... GlobalTracer.register(tracer);
...
... GlobalTracer.register(tracer); ...
... GlobalTracer.register(tracer); ...
... GlobalTracer.register(tracer); ...
... GlobalTracer.register(tracer); ...
...GlobalTracer.register(tracer); ...
... ...
... return ...
... return tracer;
...
... return tracer; ...
... return tracer; }
} Jaeger ...
...return tracer; }
} Jaeger configuration ...
...tracer; }
} Jaeger configuration either ...
...fraction for MicroProfile-Rest-Client.
<dependencyManagement> <dependencies> ...
...for MicroProfile-Rest-Client.
<dependencyManagement> <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... <artifactId>bom</artifactId>
...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
...<artifactId>bom</artifactId> ...
... ...
... ...
... <version>${version.thorntail}</version>
...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
...<version>${version.thorntail}</version> ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> </dependencies>
</dependencyManagement> ...
... </dependency> </dependencies>
</dependencyManagement> <dependencies>
...
...</dependency> </dependencies>
</dependencyManagement> <dependencies> ...
... </dependencies>
</dependencyManagement> <dependencies> <dependency>
...
...</dependencies>
</dependencyManagement> <dependencies> <dependency> ...
...<dependencies> <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... <artifactId>microprofile-config</artifactId>
...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> </dependency>
...
... <artifactId>microprofile-config</artifactId> </dependency> ...
...<artifactId>microprofile-config</artifactId> </dependency> ...
... </dependency> <dependency>
...
... </dependency> <dependency> ...
...</dependency> <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... <artifactId>microprofile-restclient</artifactId>
...
... <artifactId>microprofile-restclient</artifactId> ...
... <artifactId>microprofile-restclient</artifactId> ...
... <artifactId>microprofile-restclient</artifactId> </dependency>
...
... <artifactId>microprofile-restclient</artifactId> </dependency> ...
...<artifactId>microprofile-restclient</artifactId> </dependency> ...
... </dependency> <dependency>
...
... </dependency> <dependency> ...
...</dependency> <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... <artifactId>microprofile-opentracing</artifactId>
...
... <artifactId>microprofile-opentracing</artifactId> ...
... <artifactId>microprofile-opentracing</artifactId> ...
... <artifactId>microprofile-opentracing</artifactId> ...
... <artifactId>microprofile-opentracing</artifactId> </dependency>
</dependencies> Additionally ...
...<artifactId>microprofile-opentracing</artifactId> </dependency>
</dependencies> Additionally to ...
... </dependency>
</dependencies> Additionally to the ...
...traces.
Throntail YAML configuration:
thorntail: jaeger: ...
...configuration:
thorntail: jaeger: service-name: ...
... jaeger: service-name: microprofile-opentracing-thorntail
...
...jaeger: service-name: microprofile-opentracing-thorntail ...
... service-name: microprofile-opentracing-thorntail agent-host: ...
...service-name: microprofile-opentracing-thorntail agent-host: localhost
...
...microprofile-opentracing-thorntail agent-host: localhost ...
... agent-host: localhost agent-port: ...
...agent-host: localhost agent-port: 6831
...
...localhost agent-port: 6831 ...
... agent-port: 6831 reporter-log-spans: ...
...agent-port: 6831 reporter-log-spans: true
...
...6831 reporter-log-spans: true ...
... reporter-log-spans: true reporter-flush-interval: ...
...reporter-log-spans: true reporter-flush-interval: 2000
...
...true reporter-flush-interval: 2000 ...
... reporter-flush-interval: 2000 sampler-type: ...
...reporter-flush-interval: 2000 sampler-type: const
...
...2000 sampler-type: const ...
... sampler-type: const sampler-parameter: ...
...sampler-type: const sampler-parameter: 1 Integration ...
...const sampler-parameter: 1 Integration with ...
...specific Quarkus version.
<dependencyManagement> <dependencies> ...
...version.
<dependencyManagement> <dependencies> ...
... <dependencies> <dependency>
...
...<dependencies> <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... <artifactId>quarkus-bom</artifactId>
...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
...<artifactId>quarkus-bom</artifactId> ...
... ...
... ...
... <version>${quarkus.version}</version>
...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
...<version>${quarkus.version}</version> ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> </dependencies>
...
... </dependency> </dependencies>
</dependencyManagement> ...
...</dependency> </dependencies>
</dependencyManagement> <dependencies>
...
...</dependencies>
</dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> <!-- ...
...<dependencies> <!-- MicroProfile-Config ...
... <!-- MicroProfile-Config is ...
...of configuring ...
...configuring ...
... ...
... Quarkus, ...
... Quarkus, so ...
... Quarkus, so there ...
...a dependency --> ...
...dependency --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-rest-client</artifactId>
...
... <artifactId>quarkus-rest-client</artifactId> ...
... <artifactId>quarkus-rest-client</artifactId> ...
... <artifactId>quarkus-rest-client</artifactId> ...
... <artifactId>quarkus-rest-client</artifactId> ...
...<artifactId>quarkus-rest-client</artifactId> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> <!-- ...
...</dependency> <!-- Quarkus ...
... <!-- Quarkus uses ...
...smallrye implementation --> ...
...implementation --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-smallrye-opentracing</artifactId>
...
... <artifactId>quarkus-smallrye-opentracing</artifactId> ...
... <artifactId>quarkus-smallrye-opentracing</artifactId> ...
... <artifactId>quarkus-smallrye-opentracing</artifactId> ...
... <artifactId>quarkus-smallrye-opentracing</artifactId> ...
...<artifactId>quarkus-smallrye-opentracing</artifactId> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> <!-- ...
...</dependency> <!-- Because ...
... <!-- Because we ...
...Tracer --> ...
...--> ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-jaeger</artifactId>
...
... <artifactId>quarkus-jaeger</artifactId> ...
... <artifactId>quarkus-jaeger</artifactId> ...
... <artifactId>quarkus-jaeger</artifactId> ...
... <artifactId>quarkus-jaeger</artifactId> ...
...<artifactId>quarkus-jaeger</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> <!-- ...
...</dependency> <!-- Because ...
... <!-- Because we ...
...server and ...
...and ...
... ...
... ...
... ...
... ...
... ...
... client ...
... client side ...
... client side tracing ...
...side tracing --> ...
...tracing --> ...
...--> ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.opentracing.contrib</groupId>
...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
...<groupId>io.opentracing.contrib</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>opentracing-jaxrs2</artifactId>
...
... <artifactId>opentracing-jaxrs2</artifactId> ...
... <artifactId>opentracing-jaxrs2</artifactId> ...
... <artifactId>opentracing-jaxrs2</artifactId> ...
... <artifactId>opentracing-jaxrs2</artifactId> ...
...<artifactId>opentracing-jaxrs2</artifactId> ...
... ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> <!-- ...
...</dependency> <!-- Because ...
... <!-- Because we ...
...Tracer --> ...
...--> ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.opentracing.contrib</groupId>
...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
... <groupId>io.opentracing.contrib</groupId> ...
...<groupId>io.opentracing.contrib</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>opentracing-tracerresolver</artifactId>
...
... <artifactId>opentracing-tracerresolver</artifactId> ...
... <artifactId>opentracing-tracerresolver</artifactId> ...
... <artifactId>opentracing-tracerresolver</artifactId> ...
... <artifactId>opentracing-tracerresolver</artifactId> ...
...<artifactId>opentracing-tracerresolver</artifactId> ...
... ...
... </dependency>
</dependencies> Additionally ...
... </dependency>
</dependencies> Additionally to ...
... </dependency>
</dependencies> Additionally to the ...
...TracerFactory implements ...
...implements io.opentracing.contrib.tracerresolver.TracerFactory ...
... io.opentracing.contrib.tracerresolver.TracerFactory { ...
... io.opentracing.contrib.tracerresolver.TracerFactory { ...
... io.opentracing.contrib.tracerresolver.TracerFactory { @Override
...
...io.opentracing.contrib.tracerresolver.TracerFactory { @Override ...
...{ @Override ...
... @Override public ...
... @Override public Tracer ...
...@Override public Tracer getTracer() ...
...Tracer getTracer() { ...
...getTracer() { ...
...{ ...
... ...
... Configuration ...
... Configuration configuration ...
... Configuration configuration = ...
...configuration = Configuration.fromEnv(); ...
...= Configuration.fromEnv(); ...
...Configuration.fromEnv(); ...
... ...
... Tracer ...
... Tracer tracer ...
... Tracer tracer = ...
...tracer = configuration.getTracer(); ...
...= configuration.getTracer(); ...
...configuration.getTracer(); ...
... ...
... GlobalTracer.register(tracer);
...
... GlobalTracer.register(tracer); ...
... GlobalTracer.register(tracer); ...
... GlobalTracer.register(tracer); ...
... GlobalTracer.register(tracer); ...
...GlobalTracer.register(tracer); ...
... ...
... return ...
... return tracer;
...
... return tracer; ...
... return tracer; }
} META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory
...
...return tracer; }
} META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory ...
...tracer; }
} META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory ...
... }
} META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory ...
... }
} META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory at.ihet.samples.microprofile.opentracing.TracerFactory The ...
...}
} META-INF/services/io.opentracing.contrib.tracerresolver.TracerFactory at.ihet.samples.microprofile.opentracing.TracerFactory The TracerFactory ...
... at.ihet.samples.microprofile.opentracing.TracerFactory The TracerFactory is ...
...implements ServerSpanDecorator { @Override
...
...ServerSpanDecorator { @Override ...
...{ @Override ...
... @Override public ...
... @Override public void ...
...@Override public void decorateRequest(ContainerRequestContext ...
...void decorateRequest(ContainerRequestContext ...
...decorateRequest(ContainerRequestContext ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... requestContext, ...
... requestContext, Span ...
... requestContext, Span span) ...
...Span span) { ...
...span) { ...
...{ span.setOperationName(requestContext.getUriInfo().getPath());
...
... span.setOperationName(requestContext.getUriInfo().getPath()); ...
... span.setOperationName(requestContext.getUriInfo().getPath()); ...
... span.setOperationName(requestContext.getUriInfo().getPath()); } ...
... span.setOperationName(requestContext.getUriInfo().getPath()); } ...
...span.setOperationName(requestContext.getUriInfo().getPath()); } ...
... } @Override
...
... } @Override ...
...} @Override ...
... @Override public ...
... @Override public void ...
...@Override public void decorateResponse(ContainerResponseContext ...
...void decorateResponse(ContainerResponseContext ...
...decorateResponse(ContainerResponseContext ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... responseContext, ...
... responseContext, Span ...
... responseContext, Span span) ...
...Span span) { ...
...span) { ...
...{ ...
... ...
... span.setBaggageItem("response.body", ...
... span.setBaggageItem("response.body", ...
... span.setBaggageItem("response.body", ...
... span.setBaggageItem("response.body", ...
... span.setBaggageItem("response.body", ...
...span.setBaggageItem("response.body", ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... JsonbBuilder.create().toJson(response.getEntity()));
...
... JsonbBuilder.create().toJson(response.getEntity())); ...
... JsonbBuilder.create().toJson(response.getEntity())); ...
... JsonbBuilder.create().toJson(response.getEntity())); }
} // ...
... JsonbBuilder.create().toJson(response.getEntity())); }
} // Register ...
...JsonbBuilder.create().toJson(response.getEntity())); }
} // Register server ...
...implements DynamicFeature { private ...
...DynamicFeature { private static ...
...{ private static DynamicFeature ...
...tracingFeature = new ...
...= new ...
... ...
... ...
... ...
... ...
... ...
... ServerTracingDynamicFeature.Builder(GlobalTracer.get())
...
... ServerTracingDynamicFeature.Builder(GlobalTracer.get()) ...
... ServerTracingDynamicFeature.Builder(GlobalTracer.get()) ...
... ServerTracingDynamicFeature.Builder(GlobalTracer.get()) ...
... ServerTracingDynamicFeature.Builder(GlobalTracer.get()) ...
...ServerTracingDynamicFeature.Builder(GlobalTracer.get()) ...
... ...
... ...
... ...
... ...
... ...
... // ...
... // Here ...
... // Here we ...
...register our decorator ...
...our decorator ...
...decorator ...
... ...
... ...
... ...
... ...
... ...
... .withDecorators(Collections.singletonList(
...
... .withDecorators(Collections.singletonList( ...
... .withDecorators(Collections.singletonList( ...
... .withDecorators(Collections.singletonList( ...
... .withDecorators(Collections.singletonList( ...
....withDecorators(Collections.singletonList( ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... new ...
... new ServerTracingDecorator()))
...
... new ServerTracingDecorator())) ...
... new ServerTracingDecorator())) ...
...new ServerTracingDecorator())) ...
...ServerTracingDecorator())) ...
... ...
... ...
... ...
... ...
... ...
... .withSerializationDecorators(Collections.emptyList())
...
... .withSerializationDecorators(Collections.emptyList()) ...
... .withSerializationDecorators(Collections.emptyList()) ...
... .withSerializationDecorators(Collections.emptyList()) ...
... .withSerializationDecorators(Collections.emptyList()) ...
....withSerializationDecorators(Collections.emptyList()) ...
... ...
... ...
... ...
... ...
... ...
... .withTraceSerialization(false)
...
... .withTraceSerialization(false) ...
... .withTraceSerialization(false) ...
... .withTraceSerialization(false) ...
... .withTraceSerialization(false) ...
....withTraceSerialization(false) ...
... ...
... ...
... ...
... ...
... ...
... .withJoinExistingActiveSpan(false)
...
... .withJoinExistingActiveSpan(false) ...
... .withJoinExistingActiveSpan(false) ...
... .withJoinExistingActiveSpan(false) ...
... .withJoinExistingActiveSpan(false) ...
....withJoinExistingActiveSpan(false) ...
... ...
... ...
... ...
... ...
... ...
... .build(); ...
... .build(); ...
... .build(); ...
... .build(); @Override
...
... .build(); @Override ...
....build(); @Override ...
... @Override public ...
... @Override public void ...
...@Override public void configure(ResourceInfo ...
...configure(ResourceInfo resourceInfo, ...
...resourceInfo, ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... FeatureContext ...
... FeatureContext context) ...
... FeatureContext context) {
...
...FeatureContext context) { ...
...context) { ...
...{ ...
... ...
... // ...
... // Here ...
... // Here we ...
...custom built feature ...
...built feature ...
...feature ...
... ...
... tracingFeature.configure(resourceInfo, ...
... tracingFeature.configure(resourceInfo, context);
...
... tracingFeature.configure(resourceInfo, context); ...
... tracingFeature.configure(resourceInfo, context); }
} // ...
...tracingFeature.configure(resourceInfo, context); }
} // Client ...
...context); }
} // Client side ...
...implements ClientSpanDecorator { @Override
...
...ClientSpanDecorator { @Override ...
...{ @Override ...
... @Override public ...
... @Override public void ...
...@Override public void decorateRequest(ClientRequestContext ...
...decorateRequest(ClientRequestContext requestContext, ...
...requestContext, ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... Span ...
... Span span) ...
... Span span) {
...
...Span span) { ...
...span) { ...
...{ ...
... ...
... span.setBaggageItem("request.body",
...
... span.setBaggageItem("request.body", ...
... span.setBaggageItem("request.body", ...
... span.setBaggageItem("request.body", ...
... span.setBaggageItem("request.body", ...
...span.setBaggageItem("request.body", ...
... ...
... ...
... ...
... ...
... ...
... ...
... JsonbBuilder.create().toJson(response.getEntity()));
...
... JsonbBuilder.create().toJson(response.getEntity())); ...
... JsonbBuilder.create().toJson(response.getEntity())); ...
... JsonbBuilder.create().toJson(response.getEntity())); ...
... JsonbBuilder.create().toJson(response.getEntity())); ...
...JsonbBuilder.create().toJson(response.getEntity())); ...
... ...
... span.setOperationName(String.format(" ...
... span.setOperationName(String.format(" %s",
...
... span.setOperationName(String.format(" %s", ...
... span.setOperationName(String.format(" %s", ...
...span.setOperationName(String.format(" %s", ...
...%s", ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... requestContext.getUri().getHost(),
...
... requestContext.getUri().getHost(), ...
... requestContext.getUri().getHost(), ...
... requestContext.getUri().getHost(), ...
... requestContext.getUri().getHost(), ...
...requestContext.getUri().getHost(), ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... requestContext.getUri().getPath()));
...
... requestContext.getUri().getPath())); ...
... requestContext.getUri().getPath())); ...
... requestContext.getUri().getPath())); } ...
... requestContext.getUri().getPath())); } ...
...requestContext.getUri().getPath())); } ...
... } @Override
...
... } @Override ...
...} @Override ...
... @Override public void ...
... @Override public void decorateResponse(ClientResponseContext ...
...decorateResponse(ClientResponseContext responseContext, ...
...responseContext, ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... Span ...
... Span span) ...
... Span span) {
...
...Span span) { ...
...span) { ...
...{ String ...
... String body ...
... String body = ...
...body = ""; ...
...= ""; ...
...""; if ...
... if (responseContext.hasEntity()) ...
... if (responseContext.hasEntity()) {
...
...if (responseContext.hasEntity()) { ...
...(responseContext.hasEntity()) { ...
...{ ...
... body ...
... body = ...
... body = readEntityFromInputStream(
...
...body = readEntityFromInputStream( ...
...= readEntityFromInputStream( ...
...readEntityFromInputStream( ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... responseContext.getEntityStream());
...
... responseContext.getEntityStream()); ...
... responseContext.getEntityStream()); ...
... responseContext.getEntityStream()); ...
... responseContext.getEntityStream()); ...
...responseContext.getEntityStream()); ...
... responseContext.setEntityStream(new ...
... responseContext.setEntityStream(new
...
... responseContext.setEntityStream(new ...
... responseContext.setEntityStream(new ...
...responseContext.setEntityStream(new ...
... ...
... ...
... ...
... ...
... BufferedInputStream( ...
... BufferedInputStream(
...
... BufferedInputStream( ...
... BufferedInputStream( ...
...BufferedInputStream( ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... new ...
... new ByteArrayInputStream(
...
... new ByteArrayInputStream( ...
... new ByteArrayInputStream( ...
...new ByteArrayInputStream( ...
...ByteArrayInputStream( ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... body.getBytes(StandardCharsets.UTF_8))));
...
... body.getBytes(StandardCharsets.UTF_8)))); ...
... body.getBytes(StandardCharsets.UTF_8)))); ...
... body.getBytes(StandardCharsets.UTF_8)))); ...
... body.getBytes(StandardCharsets.UTF_8)))); ...
...body.getBytes(StandardCharsets.UTF_8)))); ...
... } ...
... } ...
... } ...
... } ...
... } ...
...} ...
... ...
... span.setBaggageItem("response.body", ...
... span.setBaggageItem("response.body", body);
...
... span.setBaggageItem("response.body", body); ...
... span.setBaggageItem("response.body", body); } ...
...span.setBaggageItem("response.body", body); } ...
...body); } ...
... } private ...
... } private String ...
...} private String readEntityFromInputStream(final ...
...InputStream is) { ...
...is) { ...
...{ try ...
... try {
...
... try { ...
... try { ...
...try { ...
...{ ...
... ...
... ...
... ...
... ByteArrayOutputStream ...
... ByteArrayOutputStream bos ...
... ByteArrayOutputStream bos = ...
...= new ByteArrayOutputStream(1024); ...
...new ByteArrayOutputStream(1024); ...
...ByteArrayOutputStream(1024); ...
... ...
... ...
... ...
... IOUtils.copy(is, ...
... IOUtils.copy(is, bos);
...
... IOUtils.copy(is, bos); ...
... IOUtils.copy(is, bos); ...
...IOUtils.copy(is, bos); ...
...bos); ...
... ...
... ...
... ...
... return ...
... return new ...
... return new String(bos.toByteArray(),StandardCharsets.UTF_8);
...
...return new String(bos.toByteArray(),StandardCharsets.UTF_8); ...
...new String(bos.toByteArray(),StandardCharsets.UTF_8); ...
...String(bos.toByteArray(),StandardCharsets.UTF_8); ...
... ...
... } ...
... } catch ...
... } catch (Throwable ...
...(Throwable e) { ...
...e) { ...
...{ ...
... ...
... ...
... ...
... ...
... ...
... return ...
... return "not_readable: ...
... return "not_readable: " ...
..." + e.getMessage(); ...
...+ e.getMessage(); ...
...e.getMessage(); ...
... ...
... }
...
... } ...
... } ...
... } }
} The ...
... } }
} The client ...
...} }
} The client side ...
...ExternalRestResource createRestClient() { try {
...
...createRestClient() { try { ...
... try { final ...
...try { final ClientTracingFeature ...
...{ final ClientTracingFeature feature ...
...feature = createClientTracingFeature(); return ...
...= createClientTracingFeature(); return RestClientBuilder.newBuilder()
...
...createClientTracingFeature(); return RestClientBuilder.newBuilder() ...
... return RestClientBuilder.newBuilder() ...
...return RestClientBuilder.newBuilder() ...
...RestClientBuilder.newBuilder() ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .baseUrl(new ...
... .baseUrl(new URL("http://httpbin.org"))
...
... .baseUrl(new URL("http://httpbin.org")) ...
... .baseUrl(new URL("http://httpbin.org")) ...
....baseUrl(new URL("http://httpbin.org")) ...
...URL("http://httpbin.org")) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .readTimeout(2000, ...
... .readTimeout(2000, TimeUnit.SECONDS)
...
... .readTimeout(2000, TimeUnit.SECONDS) ...
... .readTimeout(2000, TimeUnit.SECONDS) ...
....readTimeout(2000, TimeUnit.SECONDS) ...
...TimeUnit.SECONDS) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .connectTimeout(2000, ...
... .connectTimeout(2000, TimeUnit.SECONDS)
...
... .connectTimeout(2000, TimeUnit.SECONDS) ...
... .connectTimeout(2000, TimeUnit.SECONDS) ...
....connectTimeout(2000, TimeUnit.SECONDS) ...
...TimeUnit.SECONDS) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... // ...
... // Here ...
... // Here we ...
...custom built feature ...
...built feature ...
...feature ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .register(feature)
...
... .register(feature) ...
... .register(feature) ...
... .register(feature) ...
... .register(feature) ...
....register(feature) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .build(ExternalRestResource.class);
...
... .build(ExternalRestResource.class); ...
... .build(ExternalRestResource.class); ...
... .build(ExternalRestResource.class); } catch ...
... .build(ExternalRestResource.class); } catch (MalformedURLException ...
...(MalformedURLException e) { throw ...
...e) { throw new ...
...{ throw new RuntimeException("URI ...
...is not valid"); }
} private ClientTracingFeature ...
...not valid"); }
} private ClientTracingFeature createClientTracingFeature() ...
...ClientTracingFeature createClientTracingFeature() { return new ClientTracingFeature.Builder(GlobalTracer.get())
...
...return new ClientTracingFeature.Builder(GlobalTracer.get()) ...
...new ClientTracingFeature.Builder(GlobalTracer.get()) ...
...ClientTracingFeature.Builder(GlobalTracer.get()) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .withTraceSerialization(false)
...
... .withTraceSerialization(false) ...
... .withTraceSerialization(false) ...
... .withTraceSerialization(false) ...
... .withTraceSerialization(false) ...
....withTraceSerialization(false) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... // ...
... // Here ...
... // Here we ...
...register our decorator ...
...our decorator ...
...decorator ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .withDecorators(Collections.singletonList(
...
... .withDecorators(Collections.singletonList( ...
... .withDecorators(Collections.singletonList( ...
... .withDecorators(Collections.singletonList( ...
... .withDecorators(Collections.singletonList( ...
....withDecorators(Collections.singletonList( ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... new ...
... new ClientTracingDecorator()))
...
... new ClientTracingDecorator())) ...
... new ClientTracingDecorator())) ...
...new ClientTracingDecorator())) ...
...ClientTracingDecorator())) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... .build();
} Trace ...
... .build();
} Trace CDI ...
... .build();
} Trace CDI Beans
MicroProfile-Opentracing ...
...class CustomRestResource { ...
}
Trace ...
...CustomRestResource { ...
}
Trace rest ...
...{ ...
}
Trace rest clients
Unfortunately ...
...a custom tracing feature
@RegisterRestClient(configKey = "externalResource")
@RegisterProviders(@RegisterProvider(ClientTracingFeature.class))
@Path("/")
public ...
...interface ExternalRestResource { ...
} // If ...
...ExternalRestResource { ...
} // If you ...
Anzeigen
Blog
Keycloak für Learning Friday Projekt "Hogarama"
Anzeigen
Blog
First Step - JEE Microservices with MicroProfile-Config
...as JBoss modules.
<dependency> ...
...JBoss modules.
<dependency> <groupId>org.eclipse.microprofile.config</groupId>
...
...modules.
<dependency> <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> ...
... <groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId>
...
...<groupId>org.eclipse.microprofile.config</groupId> <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> ...
... <artifactId>microprofile-config-api</artifactId> <version>${version.microprofile.config}</version>
...
...<artifactId>microprofile-config-api</artifactId> <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> ...
... <version>${version.microprofile.config}</version> <scope>provided</scope>
</dependency> Integration ...
...<version>${version.microprofile.config}</version> <scope>provided</scope>
</dependency> Integration with ...
... <scope>provided</scope>
</dependency> Integration with Thorntail
Thorntail ...
...fraction for MicroProfile-Config.
<dependencyManagement> ...
...for MicroProfile-Config.
<dependencyManagement> ...
...MicroProfile-Config.
<dependencyManagement> <dependencies>
...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... ...
... ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <artifactId>bom</artifactId>
...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
... <artifactId>bom</artifactId> ...
...<artifactId>bom</artifactId> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <version>${version.thorntail}</version>
...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
... <version>${version.thorntail}</version> ...
...<version>${version.thorntail}</version> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> ...
... </dependency> ...
...</dependency> </dependencies>
...
... </dependencies> ...
... </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> <dependencies>
...
...</dependencies> </dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... <groupId>io.thorntail</groupId>
...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
... <groupId>io.thorntail</groupId> ...
...<groupId>io.thorntail</groupId> ...
... ...
... ...
... ...
... <artifactId>microprofile-config</artifactId>
...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
... <artifactId>microprofile-config</artifactId> ...
...<artifactId>microprofile-config</artifactId> </dependency>
...
... </dependency> ...
... </dependency> </dependencies> Integration ...
... </dependency> </dependencies> Integration with Quarkus
Quarkus, ...
...specific Quarkus version.
<dependencyManagement> <dependencies> ...
...version.
<dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... <dependency>
...
... <dependency> ...
... <dependency> ...
... <dependency> ...
... <dependency> ...
...<dependency> ...
... ...
... ...
... ...
... ...
... <groupId>io.quarkus</groupId>
...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
... <groupId>io.quarkus</groupId> ...
...<groupId>io.quarkus</groupId> ...
... ...
... ...
... ...
... ...
... <artifactId>quarkus-bom</artifactId>
...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
... <artifactId>quarkus-bom</artifactId> ...
...<artifactId>quarkus-bom</artifactId> ...
... ...
... ...
... ...
... ...
... <version>${quarkus.version}</version>
...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
... <version>${quarkus.version}</version> ...
...<version>${quarkus.version}</version> ...
... ...
... ...
... ...
... ...
... <type>pom</type>
...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
... <type>pom</type> ...
...<type>pom</type> ...
... ...
... ...
... ...
... ...
... <scope>import</scope>
...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
... <scope>import</scope> ...
...<scope>import</scope> ...
... </dependency>
...
... </dependency> ...
... </dependency> ...
... </dependency> </dependencies> ...
... </dependency> </dependencies> </dependencyManagement> ...
... </dependencies> </dependencyManagement> <dependencies>
...
...</dependencies> </dependencyManagement> <dependencies> ...
...</dependencyManagement> <dependencies> ...
... <dependencies> ...
...<dependencies> ...
... ...
... <!-- ...
... <!-- Does ...
... <!-- Does not ...
...dependency defined. ...
...defined. ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... It ...
... It uses ...
... It uses Smallrye ...
...implementation of ...
...of ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... the ...
... the MicroProfile-Config ...
... the MicroProfile-Config as ...
...as default ...
...default ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... for ...
... for configurations ...
... for configurations -->
...
...for configurations --> </dependencies> How to provide ...
...in standalone.xml:
<system-properties> <property ...
...standalone.xml:
<system-properties> <property name="conax.request.dir" ...
...<system-properties> <property name="conax.request.dir" value="/tmp/cmnt/req"/>
...
...standalone.xml:
<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source ...
...<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="props">
...
...xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="props"> ...
... <config-source name="props"> ...
...<config-source name="props"> ...
...name="props"> ...
... ...
... <property ...
... <property name="prop1" ...
... <property name="prop1" value="foo"/>
...
...<property name="prop1" value="foo"/> ...
...name="prop1" value="foo"/> ...
...value="foo"/> ...
... ...
... <property ...
... <property name="prop2" ...
... <property name="prop2" value="bar"/>
...
...<property name="prop2" value="bar"/> </config-source>
</subsystem> Directory ...
...name="prop2" value="bar"/> </config-source>
</subsystem> Directory configuration ...
...value="bar"/> </config-source>
</subsystem> Directory configuration in ...
...standalone.xml:
<subsystem xmlns="urn:wildfly:microprofile-config-smallrye:1.0"> <config-source name="file-props"> ...
... <config-source name="file-props"> ...
...<config-source name="file-props"> ...
...name="file-props"> <dir ...
... <dir path="/etc/config/numbers-app"/>
...
... <dir path="/etc/config/numbers-app"/> ...
... <dir path="/etc/config/numbers-app"/> </config-source>
</subsystem> Configuring ...
...via the JBoss-CLI: ...
...the JBoss-CLI: ...
...JBoss-CLI: ...
... ...
... ...
... ...
... ...
... /subsystem=microprofile-config-smallrye/config-source=file-props ...
... /subsystem=microprofile-config-smallrye/config-source=file-props \ ...
...
/subsystem=microprofile-config-smallrye/config-source=file-props \ ...
.../subsystem=microprofile-config-smallrye/config-source=file-props \ ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... :add(dir={path=/etc/config/numbers-app}) Configuring ...
... :add(dir={path=/etc/config/numbers-app}) Configuring properties ...
... :add(dir={path=/etc/config/numbers-app}) Configuring properties via ...
...via the JBoss-CLI: /subsystem=microprofile-config-smallrye/config-source=props ...
...the JBoss-CLI: /subsystem=microprofile-config-smallrye/config-source=props \
...
...
/subsystem=microprofile-config-smallrye/config-source=props \ ...
.../subsystem=microprofile-config-smallrye/config-source=props \ ...
...\ ...
... ...
... ...
... ...
... ...
... :add(properties={"prop1" ...
... :add(properties={"prop1" = ...
... :add(properties={"prop1" = "foo", ...
...MicroProfile-Config configuration: # Configurations for ...
...for all stages thorntail: ...
...stages thorntail: microprofile:
...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config:
...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources:
...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... STATIC_CONFIG:
...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
... STATIC_CONFIG: ...
...STATIC_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... properties:
...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
...properties: ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... info: ...
... info: "The ...
... info: "The application ...
..."The application info..." — — -
...
...— — - project: ...
...- project: stage: ...
... project: stage: local ...
...project: stage: local
...
...stage: local thorntail: ...
... thorntail: microprofile:
...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config:
...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources:
...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... LOCAL_CONFIG:
...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
... LOCAL_CONFIG: ...
...LOCAL_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... properties:
...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
...properties: ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... prop: ...
... prop: "local-prop"
...
... prop: "local-prop" ...
... prop: "local-prop" — — -
...
...— — - project: ...
...- project: stage: ...
... project: stage: test
...
...project: stage: test ...
... stage: test thorntail: ...
...test thorntail: microprofile:
...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config:
...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources:
...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... TEST_CONFIG:
...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
... TEST_CONFIG: ...
...TEST_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... properties:
...
... properties: ...
... properties: ...
... properties: ...
... properties: ...
...properties: ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... prop: ...
... prop: "test-prop" ...
... prop: "test-prop"
...
...prop: "test-prop" — — -
...
...— — - project: ...
...- project: stage: ...
... project: stage: cloud
...
...project: stage: cloud ...
... stage: cloud thorntail: ...
...cloud thorntail: microprofile:
...
... thorntail: microprofile: ...
...thorntail: microprofile: ...
... microprofile: ...
... microprofile: ...
...microprofile: config:
...
... config: ...
... config: ...
... config: ...
... config: ...
...config: ...
... ...
... config-sources:
...
... config-sources: ...
... config-sources: ...
... config-sources: ...
... config-sources: ...
...config-sources: ...
... ...
... ...
... ...
... CLOUD_CONFIG:
...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
... CLOUD_CONFIG: ...
...CLOUD_CONFIG: ...
... ...
... ...
... ...
... ...
... ...
... Dir: ...
... Dir: “/config/app” How ...
... Dir: “/config/app” How to ...
...class User { public final String ...
...final String username; public final String ...
...final String firstname; public User(String username, ...
...String firstname) { this.username ...
...firstname) { this.username = ...
...{ this.username = username;
...
...this.username = username; this.firstname ...
...= username; this.firstname = ...
...username; this.firstname = firstname;
...
...this.firstname = firstname; }
} // Converts a ...
...implements Converter<User> { @Override public ...
...{ @Override public User convert(String ...
...convert(String value) { final ...
...value) { final String[] ...
...{ final String[] properties ...
...properties = value.split(";"); final ...
...= value.split(";"); final String ...
...value.split(";"); final String username ...
...final String username = properties; ...
... = properties; final ...
...= properties; final String ...
...properties; final String firstname ...
...final String firstname = properties; ...
... = properties; return ...
...= properties; return new ...
...properties; return new User(username, ...
...new User(username, firstname); }
} How to provide ...
...class Configuration { @Inject @ConfigProperty(name ...
...{ @Inject @ConfigProperty(name = "info.text", ...
...= "info.text", defaultValue=“...”) private String infoText; ...
...private String infoText; @Inject @ConfigProperty(name ...
...infoText; @Inject @ConfigProperty(name = "google.apiKey")
...
...@ConfigProperty(name = "google.apiKey") private String apiKey; ...
...private String apiKey; // Getters for ...
Anzeigen
Blog
JEE Microservices with MicroProfile
Anzeigen
Blog
Wir beleuchten die praktischen Probleme und theoretischen Hintergründe von Transaktionen in der Cloud.
Anzeigen
Blog
Vom Sourcecode zu einer fertigen Anwendung in einem Container. Das ist der “source to image” (S2I) Build.
...new-project s2i-builder-maven \ ...
...s2i-builder-maven \ --display-name="S2I ...
...\ --display-name="S2I Maven ...
... --display-name="S2I Maven Builder" ...
...Maven Builder" \ ...
...Builder" \ --description="This ...
...\ --description="This project ...
... --description="This project contains ...
...and use ...
...use ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... the ...
... the builder ...
... the builder to ...
...The hello world ...
...hello world ...
...world ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... application ...
... application used ...
... application used here ...
...new-build s2i-builder-maven~https://github.com/wildfly/quickstart#18.0.0.Final \ ...
...s2i-builder-maven~https://github.com/wildfly/quickstart#18.0.0.Final \ --name=binary-artefact ...
...\ --name=binary-artefact ...
... --name=binary-artefact \
...
... --name=binary-artefact \ ...
...--name=binary-artefact \ ...
... \ --env=BUILDER_CONTEXT_DIR=helloworld ...
...\ --env=BUILDER_CONTEXT_DIR=helloworld \
...
... --env=BUILDER_CONTEXT_DIR=helloworld \ ...
... --env=BUILDER_CONTEXT_DIR=helloworld \ ...
...--env=BUILDER_CONTEXT_DIR=helloworld \ --env=BUILDER_MVN_OPTIONS="-P ...
...\ --env=BUILDER_MVN_OPTIONS="-P openshift"
Sie ...
... --env=BUILDER_MVN_OPTIONS="-P openshift"
Sie haben ...
...--name=runtime --docker-image=jboss/wildfly \ ...
...--docker-image=jboss/wildfly \ --source-image=binary-artefact ...
...\ --source-image=binary-artefact \
...
... --source-image=binary-artefact \ ...
... --source-image=binary-artefact \ ...
...--source-image=binary-artefact \ --source-image-path=/deployments/target/ROOT.war:. ...
...\ --source-image-path=/deployments/target/ROOT.war:. \
...
... --source-image-path=/deployments/target/ROOT.war:. \ ...
... --source-image-path=/deployments/target/ROOT.war:. \ ...
...--source-image-path=/deployments/target/ROOT.war:. \ --dockerfile=$'FROM ...
...\ --dockerfile=$'FROM jboss/wildfly ...
... --dockerfile=$'FROM jboss/wildfly \nCOPY ...
...new-build s2i-builder-maven~https://github.com/wildfly/quickstart#18.0.0.Final \ ...
...s2i-builder-maven~https://github.com/wildfly/quickstart#18.0.0.Final \ --name=binary-artefact ...
...\ --name=binary-artefact \
...
... --name=binary-artefact \ ...
... --name=binary-artefact \ ...
...--name=binary-artefact \ --env=BUILDER_MVN_MIRROR="* ...
...\ --env=BUILDER_MVN_MIRROR="* |
https://my-maven-mirror/path/to/maven-public/" ...
... --env=BUILDER_MVN_MIRROR="* |
https://my-maven-mirror/path/to/maven-public/" \
...
...--env=BUILDER_MVN_MIRROR="* |
https://my-maven-mirror/path/to/maven-public/" \ ...
...|
https://my-maven-mirror/path/to/maven-public/" \ --env=BUILDER_MVN_MIRROR_ALLOW_FALLBACK=true Hinweis: ...
...\ --env=BUILDER_MVN_MIRROR_ALLOW_FALLBACK=true Hinweis: Sie ...
... --env=BUILDER_MVN_MIRROR_ALLOW_FALLBACK=true Hinweis: Sie können ...
Anzeigen
Blog
Die Installation von OpenShift auf AWS ist bereits recht einfach. Wir zeigen Ihnen wie!
Anzeigen
Blog
How to - not - DevOps on Openshift
Anzeigen
Blog
Professionelle Softwareentwicklung - Basics
Anzeigen
Blog
Monitoring mit Prometheus
...nachhelfen:
containers:
- args: - ...
...- args: - '--config.file=/prometheus-data/prometheus.yml'
...
...args: - '--config.file=/prometheus-data/prometheus.yml' ...
... - '--config.file=/prometheus-data/prometheus.yml' - ...
...- '--config.file=/prometheus-data/prometheus.yml' - '--storage.tsdb.path=/prometheus'
Prometheus ...
...'--config.file=/prometheus-data/prometheus.yml' - '--storage.tsdb.path=/prometheus'
Prometheus war ...
Anzeigen
Blog
CDI DeltaSpike Partial-Bean
...@interface Error { String ...
...Error { String code();
...
...{ String code(); ...
... String code(); String ...
...String code(); String message();
...
...code(); String message(); ...
... String message(); Class<? ...
...String message(); Class<? extends ...
...message(); Class<? extends Throwable> ...
...Throwable> exceptionClass() ...
...exceptionClass() ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... default ...
... default
RuntimeException.class;
}
Die ...
... default
RuntimeException.class;
}
Die Attribute ...
Anzeigen
Blog
Hilfe bei Integrationstests
...und haben WarpUnit gefunden.
// Wenn Web Services ...
...WorkingCageServiceImpl implements
WorkingCageService { @Inject private ...
...{ @Inject private WorkingCage workingCage;
...
...private WorkingCage workingCage; public List<Task> getOpenTasks() ...
...List<Task> getOpenTasks() { return workingCage.getOpenTasks(); ...
... return workingCage.getOpenTasks(); }
} Listing 2 public class ...
...class WorkingCage { public List<Task> getOpenTasks(){
...
...public List<Task> getOpenTasks(){ List<Task> ...
...List<Task> getOpenTasks(){ List<Task> openTasks ...
...getOpenTasks(){ List<Task> openTasks = ...
...= new ArrayList<>(); openTasks.addAll(getOpenAppointments());
...
...new ArrayList<>(); openTasks.addAll(getOpenAppointments()); ...
...ArrayList<>(); openTasks.addAll(getOpenAppointments()); ...
... openTasks.addAll(getOpenAppointments()); openTasks.addAll(getOpenDocuments());
...
... openTasks.addAll(getOpenAppointments()); openTasks.addAll(getOpenDocuments()); ...
...openTasks.addAll(getOpenAppointments()); openTasks.addAll(getOpenDocuments()); ...
... openTasks.addAll(getOpenDocuments()); return ...
... openTasks.addAll(getOpenDocuments()); return openTasks;
...
...openTasks.addAll(getOpenDocuments()); return openTasks; ...
... return openTasks; }
} Listing 3 @Inject
WorkingCage workingCage; @Test
public ...
...void testOpenRequests() { List<Request> openDocuments = ...
...openDocuments = workingCage.
getOpenDocuments(); assertThat(...);
} Listing 4 public class ...
...WorkingCageInsiderImpl implements
WorkingCageInsider { @Inject WorkingCage ...
...{ @Inject WorkingCage workingCage; ...
... WorkingCage workingCage; public List<Request> getOpenAppointments ...
...getOpenAppointments () { return ...
...() { return workingCage.getOpenAppointments ...
...{ return workingCage.getOpenAppointments ();
...
...return workingCage.getOpenAppointments (); }
} Listing 5 public class ...
...class ProxyStyleWorkingCageTest { @Test ...
...{ @Test ...
... @Test ...
...@Test ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... System.out.println("This ...
... System.out.println("This is ...
... System.out.println("This is printed ...
...in the JUnit public void testWorkingCageWithProxy() ...
...void testWorkingCageWithProxy() { ...
...testWorkingCageWithProxy() { ...
...{ ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... test ...
... test log"); WorkingCageInsider ...
... test log"); WorkingCageInsider proxyGate ...
...proxyGate = WarpUnit. ...
...= WarpUnit. ...
...WarpUnit. ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... List<Appointment> ...
... List<Appointment> appointments ...
... List<Appointment> appointments = ...
...appointments = proxyGate.
builder() ...
...= proxyGate.
builder() ...
...proxyGate.
builder() ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... getOpenAppointments();
...
... getOpenAppointments(); ...
... getOpenAppointments(); .primaryClass(WorkingCageInsiderImpl.class) ...
... getOpenAppointments(); .primaryClass(WorkingCageInsiderImpl.class) ...
...getOpenAppointments(); .primaryClass(WorkingCageInsiderImpl.class) ...
... .primaryClass(WorkingCageInsiderImpl.class) ...
....primaryClass(WorkingCageInsiderImpl.class) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... Assert.assertEquals(1, ...
... Assert.assertEquals(1, appointments.size());
...
... Assert.assertEquals(1, appointments.size()); ...
... Assert.assertEquals(1, appointments.size()); .includeInterface(true) ...
...appointments.size()); .includeInterface(true) ...
... .includeInterface(true) ...
....includeInterface(true) ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... }
...
... } ...
... } .createProxyGate(WorkingCageInsider.class); ...
... } .createProxyGate(WorkingCageInsider.class); ...
...} .createProxyGate(WorkingCageInsider.class); ...
... .createProxyGate(WorkingCageInsider.class); ...
....createProxyGate(WorkingCageInsider.class); ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... ...
... } Ein ...
... } Ein bisschen ...
... } Ein bisschen eleganter ...
...class LambdaStyleTest { @Inject WorkingCage ...
...{ @Inject WorkingCage workingCage; ...
... WorkingCage workingCage; @Test public ...
...workingCage; @Test public void testWorkingCage() ...
...void testWorkingCage() { WarpGate ...
...testWorkingCage() { WarpGate gate ...
...{ WarpGate gate = ...
...gate = WarpUnit.builder() ...
...= WarpUnit.builder() ...
...WarpUnit.builder() .primaryClass(LambdaStyleTest.class)
...
... .primaryClass(LambdaStyleTest.class) ...
... .primaryClass(LambdaStyleTest.class) ...
... .primaryClass(LambdaStyleTest.class) ...
... .primaryClass(LambdaStyleTest.class) ...
....primaryClass(LambdaStyleTest.class) .createGate(); List<Appointment> ...
... .createGate(); List<Appointment> appointments ...
... .createGate(); List<Appointment> appointments = ...
...gate.warp(() -> { ...
...-> { ...
...{ return ...
... return workingCage.getOpenAppointments();
...
... return workingCage.getOpenAppointments(); ...
... return workingCage.getOpenAppointments(); });
...
...return workingCage.getOpenAppointments(); }); ...
...workingCage.getOpenAppointments(); }); ...
... }); Assert.assertEquals(1, ...
... }); Assert.assertEquals(1, appointments.size());
...
...}); Assert.assertEquals(1, appointments.size()); ...
... Assert.assertEquals(1, appointments.size()); }
...
...Assert.assertEquals(1, appointments.size()); } ...
...appointments.size()); } } Listing ...
... } } Listing 7 @Test
public void ...
...void testNoDocuments() { WarpGate gate = ...
...gate = WarpUnit.builder() .primaryClass(DBTest.class)
...
...= WarpUnit.builder() .primaryClass(DBTest.class) ...
...WarpUnit.builder() .primaryClass(DBTest.class) ...
... .primaryClass(DBTest.class) .createGate(); ...
... .primaryClass(DBTest.class) .createGate(); ...
....primaryClass(DBTest.class) .createGate(); List<Document> ...
... .createGate(); List<Document> documents = ...
...gate.warp(() -> { return ...
...-> { return workingCage.getOpenDocuments();
...
...{ return workingCage.getOpenDocuments(); ...
... return workingCage.getOpenDocuments(); }); ...
...workingCage.getOpenDocuments(); }); //Keine ...
... }); //Keine Dokumente ...
...}); //Keine Dokumente werden ...
...Dokumente werden zurückgeliefert, //da ...
...werden zurückgeliefert, //da es ...
...zurückgeliefert, //da es kein ...
...aktives Preference gibt Assert.assertEquals(0, ...
...Preference gibt Assert.assertEquals(0, documents.size());
...
...gibt Assert.assertEquals(0, documents.size()); ...
... Assert.assertEquals(0, documents.size()); } // WAR-Deployments testen
Bis zu ...
...new EntityManipulator()) { // Instanziieren von ...
...von JPA-Entity Preference. Preference preference = ...
...= new Preference(); preference.setPreferenceKey("med.open"); preference.setPreferenceValue("true"); ...
...Preference(); preference.setPreferenceKey("med.open"); preference.setPreferenceValue("true"); // ...
...preference.setPreferenceKey("med.open"); preference.setPreferenceValue("true"); // Hier wird ...
...an Server gesendet. // und von ...
...über JPA EntityManager. // in die ...
...die Datenbank eingespielt. manipulator.insertEntity(preference); WarpGate ...
...eingespielt. manipulator.insertEntity(preference); WarpGate gate = ...
...gate = WarpUnit.builder() .primaryClass(DBTest.class)
...
...= WarpUnit.builder() .primaryClass(DBTest.class) ...
...WarpUnit.builder() .primaryClass(DBTest.class) ...
... .primaryClass(DBTest.class) .createGate(); ...
... .primaryClass(DBTest.class) .createGate(); ...
....primaryClass(DBTest.class) .createGate(); List<Document> ...
... .createGate(); List<Document> documents = ...
...gate.warp(() -> { return ...
...-> { return workingCage.getOpenDocuments();
...
...{ return workingCage.getOpenDocuments(); ...
... return workingCage.getOpenDocuments(); }); // ...
...workingCage.getOpenDocuments(); }); // Das Preference ...
...Das Preference med.open=true. // Somit wird ...
...Dokument geliefert.
Assert.assertEquals(1, documents.size()); // Der erstellte ...
...wird am Ende // durch close() ...
...durch close() entfernt }
...
...close() entfernt } ...
...entfernt } } Listing ...
... } } Listing 9 @Test ...
... } Listing 9 @Test public void testOpenAndRestrictedDocuments() ...
...throws Exception { try (EntityManipulator manipulator ...
...new EntityManipulator()) { // ...
...EntityManipulator()) { // Ein ...
...{ // Ein Preference-Eintrag ...
...der Datenbank erstellt. Preference openPreference = ...
...= new Preference(); openPreference.setPreferenceKey("med.open"); openPreference.setPreferenceValue("true");
...
...Preference(); openPreference.setPreferenceKey("med.open"); openPreference.setPreferenceValue("true"); manipulator.insertEntity(openPreference); ...
...openPreference.setPreferenceKey("med.open"); openPreference.setPreferenceValue("true"); manipulator.insertEntity(openPreference); // ...
...openPreference.setPreferenceValue("true"); manipulator.insertEntity(openPreference); // Ein bestehender ...
...aus der Datenbank // mithilfe einer ...
...einer HQL-Query geholt. Preference restrictedPreference = ...
...= 'med.restricted'", Preference.class); restrictedPreference.setPreferenceValue("true"); // ...
...Preference.class); restrictedPreference.setPreferenceValue("true"); // Hier wird ...
...an Server gesendet. // EntityManimulator ruft ...
...Methode merge() auf. // Dadurch wird ...
...der Datenbank aktualisiert. manipulator.updateEntity(restrictedPreference); WarpGate gate = ...
...gate = WarpUnit.builder() .primaryClass(DBTest.class) .createGate(); ...
...WarpUnit.builder() .primaryClass(DBTest.class) .createGate(); List<Document> ...
....primaryClass(DBTest.class) .createGate(); List<Document> documents = ...
...gate.warp(() -> { return workingCage.getOpenDocuments(); ...
... return workingCage.getOpenDocuments(); }); // Die beiden ...
...med.restricted sind true. // Somit werden ...
...beide Dokumente zurückgeliefert. Assert.assertEquals(2, documents.size()); ...
... Assert.assertEquals(2, documents.size()); // Der neue ...
...am Ende entfernt // Der aktualisierte ...
...am Ende zurückgesetzt }
...
...Ende zurückgesetzt } ...
...zurückgesetzt } } Listing ...
... } } Listing 10 <profile> ...
... } Listing 10 <profile> <id>warpunit</id> <dependencies>
...
...10 <profile> <id>warpunit</id> <dependencies> <dependency>
...
...<id>warpunit</id> <dependencies> <dependency> ...
...<dependencies> <dependency> <groupId>org.dcm4che</groupId>
...
... <dependency> <groupId>org.dcm4che</groupId> ...
...<dependency> <groupId>org.dcm4che</groupId> ...
... <groupId>org.dcm4che</groupId> <artifactId>warpunit-core</artifactId>
...
... <groupId>org.dcm4che</groupId> <artifactId>warpunit-core</artifactId> ...
...<groupId>org.dcm4che</groupId> <artifactId>warpunit-core</artifactId> ...
... <artifactId>warpunit-core</artifactId> <version>alpha-SNAPSHOT</version>
...
... <artifactId>warpunit-core</artifactId> <version>alpha-SNAPSHOT</version> ...
...<artifactId>warpunit-core</artifactId> <version>alpha-SNAPSHOT</version> </dependency>
...
... <version>alpha-SNAPSHOT</version> </dependency> </dependencies>
...
...<version>alpha-SNAPSHOT</version> </dependency> </dependencies> <properties>
...
...</dependency> </dependencies> <properties> ...
...</dependencies> <properties> <projectVersion>alpha-TEST-ONLY-SNAPSHOT</projectVersion>
...
... <properties> <projectVersion>alpha-TEST-ONLY-SNAPSHOT</projectVersion> ...
...<properties> <projectVersion>alpha-TEST-ONLY-SNAPSHOT</projectVersion> ...
... <projectVersion>alpha-TEST-ONLY-SNAPSHOT</projectVersion> </properties>
...
... <projectVersion>alpha-TEST-ONLY-SNAPSHOT</projectVersion> </properties> ...
...<projectVersion>alpha-TEST-ONLY-SNAPSHOT</projectVersion> </properties> </profile> // Den ...
... </properties> </profile> // Den Test testen
WarpUnit ...
...working-cage-ear-alpha-SNAPSHOT.ear auf WildFly oder JBoss EAP ...
Neueste Kommentare