Skip to content

Commit

Permalink
Update artemis image from 2.30.0 to 2.31.0
Browse files Browse the repository at this point in the history
(cherry picked from commit 737a2a2)
  • Loading branch information
louisa-fr authored and turing85 committed Sep 20, 2023
1 parent d8ac91e commit 621f719
Show file tree
Hide file tree
Showing 80 changed files with 1,391 additions and 24 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ jobs:
- name: Git checkout
uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'maven'
id: setup
Expand Down Expand Up @@ -142,10 +142,10 @@ jobs:
- name: Git checkout
uses: actions/checkout@v3

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'maven'

Expand Down Expand Up @@ -205,7 +205,7 @@ jobs:
- name: Get Maven Cache
uses: actions/setup-java@v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
cache: 'maven'

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}

- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11
java-version: 17
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
Expand Down
59 changes: 54 additions & 5 deletions docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ Once the BOM is added, simply add the `io.quarkiverse.artemis:quarkus-artemis-jm

We recommend to set properties `quarkus.version` and `artemis.version` to the versions you are using/need to use. We also recommend to align `artemis.version` with the artemis server version used.

If you are using `camel-quarkus`, we also recommend setting `camel-quarkus.platform.version` to the version of camel used.

== Named configurations
As with `quarkus.datasource`, we can configure multiple, named configuration. If a configuration is configured under the root `quarkus.artemis`, then this is the default or unnamed configuration.

Expand Down Expand Up @@ -258,7 +260,7 @@ NOTE: binding a property to an environment variable, like `quarkus.artemis.url=$

TIP: If we want to configure a connection solely through the implicit environment variables `QUARKUS_ARTEMIS_...`, we should enable the configuration by setting `quarkus.artemis.enabled` / `quarkus.artemis."named-configuration".enabled` to *true*. For example, if we want to configure connection `quarkus.artemis."named-1"` through the implicit environment variables, we would set `quarkus.artemis."named-1".enabled=true` and then configure the connection through environment variables `QUARKUS_ARTEMIS\__NAMED_1__...`.

Please do not try to configure a configuration purely through environment variables, without having any indication of its present in the application's configuration file. We specifically rely on the present of some configuration fragment at build-time to detect configurations.
Please do not try to configure a configuration purely through environment variables, without having any indication of its presence in the application's configuration file. We specifically rely on the presence of some configuration fragment at build-time to detect configurations.

== XA Transactions
XA Transactions must be activated on a per-configuration basis, they are not enabled by default.
Expand All @@ -284,7 +286,7 @@ If we create `ServerLocator`- (extension `quarkus-artemis-core`) or `ConnectionF
----
public class MyBeanProvider {
@ApplicationScoped
@Identified("my-server-locator") // this annotation makes it so the bean is picked up by the health endpoint
@Identifier("my-server-locator") // this annotation makes it so the bean is picked up by the health endpoint
public ServerLocator mySeverLocator(...) {
ServerLocator myServerLocator = ...;
...
Expand All @@ -298,7 +300,7 @@ public class MyBeanProvider {
----
public class MyBeanProvider {
@ApplicationScoped
@Identified("my-connection-factory") // this annotation makes it so the bean is picked up by the health endpoint
@Identifier("my-connection-factory") // this annotation makes it so the bean is picked up by the health endpoint
public ConnectionFactory myConnectionFactory(...) {
ConnectionFactory myConnectionFactory = ...;
...
Expand All @@ -311,6 +313,53 @@ If we do not want that beans created within our application is picked up by the

IMPORTANT: Note that `ServerLocator` s / `ConnectionFactory` s are only picked up when `quarkus.artemis.health.enabled` is *true*.

== Camel support
All connection factories that are configured through `quarkus-artemis-jms` are automatically registered in the camel context, if the program uses camel. This allows us to reference the connection factories by name, e.g.:

.Referencing `ConnectionFactory` s in a camel route by their bean name
[source,java,subs=attributes+]
----
from(jms("queue:in").connectionFactory("<default>"))
.to(jms("queue:out").connectionFactory("named"));
----

In `camel-quarkus`, an externally defined `ConnectionFactory` can only be referenced by its name in a route configuration if it has either a `@Named(...)` or the `@Identifier(...)` annotation. However, as mentioned above, the usage of `@Identifier(...)` should be preferred when using this extension.

.Defining an externally defined `ConnectionFactory`-bean through a `@Produces` method
[source,java,subs=attributes+]
----
@Produces
@Typed({ ConnectionFactory.class })
@ApplicationScoped
@Identifier("externally-defined")
ActiveMQConnectionFactory externallyDefinedConnectionFactory(
@ConfigProperty(name = "artemis.externally-defined.url") String externallyDefinedUrl) {
return new ActiveMQConnectionFactory(externallyDefinedUrl);
}
----

We can then use this `ConnectionFactory` as follows:

.Referencing an externally defined `ConnectionFactory`-bean by its name
[source,java,subs=attributes+]
----
from(jms("queue:in").connectionFactory("externally-defined"))
.to(jms("queue:out").connectionFactory("externally-defined"));
----

Finally, if only a single `ConnectionFactory` is defined through `quarkus-artemis-jms`, this `ConnectionFactory` is always registered as link:https://jakarta.ee/specifications/cdi/2.0/apidocs/javax/enterprise/inject/default[`@Default`] bean. This allows us to use this `ConnectionFactory` implicitly in a camel route, without setting it explicitly:

.Implicitly use the only `ConnectionFactory`-bean defined in the application
[source,java,subs=attributes+]
----
from(jms("queue:in"))
.to(jms("queue:out"));
----

This also works for an externally defined `ConnectionFactory`, as long as it is defined as `@Default` (remember that link:https://jakarta.ee/specifications/cdi/2.0/cdi-spec-2.0.html#builtin_qualifiers:[all beans that do not have any qualifier annotation are automatically `@Default` beans]).

This mechanism stops working as soon as more than one `ConnectionFactory` bean is defined in the application.

== Artemis DevServices
Artemis DevServices are automatically enabled unless `quarkus.artemis.url` / `quarkus.artemis."named-configuration".url` is set or `quarkus.artemis.devservices.enabled` / `quarkus.artemis."named-configuration".enabled` is *false* explicitly. And if you still want to use `ArtemisTestResource` in the test, you need to disable artemis devservices.

Expand All @@ -336,8 +385,8 @@ This instance can be configured by placing a `broker-named-1.xml` in `src/test/r
For an in-depth explanation of what can be configured in a `broker.xml`, please see the link:https://activemq.apache.org/components/artemis/documentation/latest/configuration-index.html:[official Artemis documentation].

== Examples
Examples can be found in the `integration-tests` module, e.g
https://github.com/quarkiverse/quarkus-artemis/tree/2.0.0/integration-tests/core/with-default[The Apache ActiveMQ Artemis Core integration with default configuration tests module]
Examples can be found in the `integration-tests` module, e.g.
https://github.com/quarkiverse/quarkus-artemis/tree/main/integration-tests/core/with-default[The Apache ActiveMQ Artemis Core integration with default configuration tests module]

[[extension-configuration-reference]]
== Configuration Reference
Expand Down
43 changes: 43 additions & 0 deletions integration-tests/camel-jms/common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-integration-test-artemis-common-parent</artifactId>
<version>999-SNAPSHOT</version>
<relativePath>../../common-parent/pom.xml</relativePath>
</parent>

<artifactId>quarkus-integration-test-artemis-camel-jms-common</artifactId>
<name>Quarkus - Artemis - Integration Tests - Camel JMS - Common</name>
<description>The Apache ActiveMQ Artemis Camel JMS integration tests common module</description>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.quarkus.it.artemis.camel.jms.common;

import static org.hamcrest.Matchers.is;

import jakarta.ws.rs.core.Response;

import org.junit.jupiter.api.Test;

import io.restassured.RestAssured;

public interface BaseSendAndReceiveTest {
@Test
default void test() {
String body = "body";
RestAssured.given().body(body)
.when().post()
.then().statusCode(is(Response.Status.OK.getStatusCode())).body(is(body));
}
}
71 changes: 71 additions & 0 deletions integration-tests/camel-jms/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-artemis-integration-tests-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>

<artifactId>quarkus-integration-test-artemis-camel-jms-parent</artifactId>
<name>Quarkus - Artemis - Integration Tests - Camel JMS Parent</name>
<description>The Apache ActiveMQ Artemis Camel JMS integration tests parent module</description>

<packaging>pom</packaging>
<modules>
<module>common</module>
<module>with-default</module>
<module>with-default-and-named</module>
<module>with-external</module>
<module>with-named</module>
<module>with-named-and-external</module>
</modules>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-camel-bom</artifactId>
<version>${camel-quarkus.platform.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Artemis -->
<dependency>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-artemis-jms</artifactId>
</dependency>

<!-- Camel Quarkus -->
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-jms</artifactId>
</dependency>

<dependency>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-integration-test-artemis-common</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
</dependency>
<dependency>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-integration-test-artemis-jms-common</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-integration-test-artemis-jms-common</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
</dependency>
</dependencies>
</project>
23 changes: 23 additions & 0 deletions integration-tests/camel-jms/with-default-and-named/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-integration-test-artemis-camel-jms-parent</artifactId>
<version>999-SNAPSHOT</version>
</parent>

<artifactId>quarkus-integration-test-artemis-camel-jms-with-default-and-named</artifactId>
<name>Quarkus - Artemis - Integration Tests - Camel JMS - With default and named configuration</name>
<description>The Apache ActiveMQ Artemis Camel JMS integration tests with default and named configuration module</description>

<dependencies>
<dependency>
<groupId>io.quarkiverse.artemis</groupId>
<artifactId>quarkus-integration-test-artemis-camel-jms-common</artifactId>
<classifier>tests</classifier>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package io.quarkus.it.artemis.camel.jms.withdefaultandnamed;

import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;

import io.quarkus.it.artemis.jms.common.ArtemisJmsConsumerManager;
import io.quarkus.it.artemis.jms.common.ArtemisJmsProducerManager;
import io.smallrye.common.annotation.Identifier;

@Path("send-and-receive")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(MediaType.TEXT_PLAIN)
public class ArtemisEndpoint {
private final ArtemisJmsProducerManager defaultProducerManager;
private final ArtemisJmsConsumerManager namedConsumerManager;

public ArtemisEndpoint(
ArtemisJmsProducerManager defaultProducerManager,
@Identifier("named") ArtemisJmsConsumerManager namedConsumerManager) {
this.defaultProducerManager = defaultProducerManager;
this.namedConsumerManager = namedConsumerManager;
}

@POST
public String sendAndReceive(String message) {
defaultProducerManager.send(message);
return namedConsumerManager.receive();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package io.quarkus.it.artemis.camel.jms.withdefaultandnamed;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;
import jakarta.jms.ConnectionFactory;

import io.quarkus.it.artemis.jms.common.ArtemisJmsConsumerManager;
import io.quarkus.it.artemis.jms.common.ArtemisJmsProducerManager;
import io.smallrye.common.annotation.Identifier;

public class BeanProducer {
@Produces
@ApplicationScoped
@Identifier("named")
ArtemisJmsConsumerManager namedConsumerManager(
@SuppressWarnings("CdiInjectionPointsInspection") @Identifier("named") ConnectionFactory connectionFactory) {
return new ArtemisJmsConsumerManager(connectionFactory, "out");
}

@Produces
@ApplicationScoped
ArtemisJmsProducerManager defaultProducerManager(
@SuppressWarnings("CdiInjectionPointsInspection") ConnectionFactory defaultConnectionFactory) {
return new ArtemisJmsProducerManager(defaultConnectionFactory, "in");
}

BeanProducer() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package io.quarkus.it.artemis.camel.jms.withdefaultandnamed;

import static org.apache.camel.builder.endpoint.StaticEndpointBuilders.jms;

import org.apache.camel.builder.RouteConfigurationBuilder;

@SuppressWarnings("unused")
public class TransferRoute extends RouteConfigurationBuilder {

@Override
public void configuration() {
from(jms("queue:in").connectionFactory("<default>"))
.to(jms("queue:out").connectionFactory("named"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
quarkus.artemis.devservices.enabled=false
quarkus.artemis."named".devservices.enabled=false
Loading

0 comments on commit 621f719

Please sign in to comment.