This is an automated email from the ASF dual-hosted git repository. klease pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-examples.git
The following commit(s) were added to refs/heads/main by this push: new 0cb49a77 Fixes4 (#127) 0cb49a77 is described below commit 0cb49a77b8c6cfbd13974102d508c77345fadeed Author: klease <38634989+kle...@users.noreply.github.com> AuthorDate: Mon Sep 11 15:32:49 2023 +0200 Fixes4 (#127) * CAMEL-19826: Fix compilation and runtime issues. Due to changes in the parent poms and components in Camel 4.x some of the examples were not compilable or runnable. Adjusted the poms, configuration and code to make them usable. --- examples/README.adoc | 22 +++++++---- examples/as2/pom.xml | 4 -- examples/cassandra-kubernetes/pom.xml | 30 +++++++++------ .../resources/jkube/cassandra-statefulset.yaml | 31 ++++++++++----- .../{log4j.properties => log4j2.properties} | 15 +++----- examples/debezium/pom.xml | 6 --- .../debezium/DebeziumPgSQLConsumerToKinesis.java | 4 +- .../src/main/resources/application.properties | 5 ++- .../debezium/src/main/resources/log4j2.properties | 12 ++++++ .../camel/example/debezium/DebeziumTest.java | 25 ++++++++++-- .../apache/camel/example/java8/MyApplication.java | 2 +- examples/jmx/pom.xml | 8 ---- examples/kotlin/pom.xml | 2 +- examples/pom.xml | 2 +- examples/spring-pulsar/pom.xml | 6 +++ examples/spring-xquery/pom.xml | 44 ++++++++++------------ .../resources/META-INF/spring/camelContext.xml | 9 ++++- .../spring-xquery/src/main/resources/broker.xml | 29 ++++++++++++++ examples/spring/pom.xml | 31 ++++++--------- .../resources/META-INF/spring/camel-context.xml | 9 ++++- examples/spring/src/main/resources/broker.xml | 29 ++++++++++++++ 21 files changed, 212 insertions(+), 113 deletions(-) diff --git a/examples/README.adoc b/examples/README.adoc index 7576d9c8..4e5ce927 100644 --- a/examples/README.adoc +++ b/examples/README.adoc @@ -11,12 +11,24 @@ View the individual example READMEs for details. == Examples // examples: START -Number of Examples: 71 (0 deprecated) +Number of Examples: 75 (0 deprecated) [width="100%",cols="4,2,4",options="header"] |=== | Example | Category | Description +| link:resume-api/resume-api-aws2-kinesis/README.md[Resume Api Aws2 Kinesis] (resume-api-aws2-kinesis) | | + +| link:resume-api/resume-api-cassandraql/README.md[Resume Api Cassandraql] (resume-api-cassandraql) | | + +| link:resume-api/resume-api-file-offset/README.md[Resume Api File Offset] (resume-api-file-offset) | | + +| link:resume-api/resume-api-fileset/README.md[Resume Api Fileset] (resume-api-fileset) | | + +| link:resume-api/resume-api-fileset-clusterized/README.md[Resume Api Fileset Clusterized] (resume-api-fileset-clusterized) | | + +| link:resume-api/resume-api-fileset-wal/README.md[Resume Api Fileset Wal] (resume-api-fileset-wal) | | + | link:as2/README.adoc[AS2 Example] (as2) | Beginner | An example which demonstrates the use of the Camel AS2 component | link:vault/aws-secrets-manager/README.adoc[Aws Secrets Manager] (aws-secrets-manager) | Beginner | An example for showing AWS Secrets Manager Camel component @@ -41,6 +53,8 @@ Number of Examples: 71 (0 deprecated) | link:ftp/README.adoc[FTP] (ftp) | Beginner | An example for showing Camel FTP integration +| link:google/google-pubsub/README.adoc[Google Pubsub] (google-pubsub) | Beginner | Google Pubsub example + | link:vault/google-secret-manager-reloading/README.adoc[Google Secret Manager Reloading] (google-secret-manager-reloading) | Beginner | An example for showing Google Secret Manager Camel component with reloading | link:java8/README.adoc[Java8] (java8) | Beginner | An example for showing Camel DSL for Java 8 @@ -97,8 +111,6 @@ Number of Examples: 71 (0 deprecated) | link:cassandra-kubernetes/README.adoc[Cassandra Kubernetes] (cassandra-kubernetes) | Cloud | An example with Camel and Cassandra running on Kubernetes -| link:google/README.adoc[Google] (google) | Cloud | Multiple Camel Google examples - | link:hazelcast-kubernetes/README.adoc[Hazelcast Kubernetes] (hazelcast-kubernetes) | Cloud | An example with Camel and Hazelcast running on Kubernetes | link:aws/main-endpointdsl-aws2/README.adoc[Main Endpointdsl Aws2] (main-endpointdsl-aws2) | Cloud | An example for showing standalone Camel with multiple AWS2 components @@ -127,8 +139,6 @@ Number of Examples: 71 (0 deprecated) | link:loadbalancing/README.adoc[Load Balancing] (loadbalancing) | EIP | An example that demonstrate load balancing messaging with mina servers (TCP/IP) -| link:resume-api/README.md[Resume Api] (resume-api) | EIP | Multiple Resume API examples - | link:transformer-demo/README.adoc[Transformer and Validator Spring XML] (transformer-demo) | Input/Output Type Contract | An example demonstrating declarative transformation and validation along data type declaration using Spring DSL @@ -141,8 +151,6 @@ Number of Examples: 71 (0 deprecated) | link:kafka/README.adoc[Kafka] (kafka) | Messaging | An example for Kafka -| link:kafka-aggregate/README.adoc[Kafka Aggregate] (kafka-aggregate) | Messaging | An example for Kafka - | link:netty-custom-correlation/README.adoc[Netty Custom Correlation] (netty-custom-correlation) | Messaging | An example for showing Camel Netty with custom codec and correlation id | link:spring-pulsar/README.adoc[Spring Pulsar] (spring-pulsar) | Messaging | An example using Spring XML to talk to the Pulsar server from different kind of client techniques diff --git a/examples/as2/pom.xml b/examples/as2/pom.xml index b767f349..53b6fe14 100644 --- a/examples/as2/pom.xml +++ b/examples/as2/pom.xml @@ -70,10 +70,6 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-spring-xml</artifactId> </dependency> - <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring-junit5</artifactId> - </dependency> <!-- logging --> <dependency> diff --git a/examples/cassandra-kubernetes/pom.xml b/examples/cassandra-kubernetes/pom.xml index c2a94d5e..75b55fcd 100644 --- a/examples/cassandra-kubernetes/pom.xml +++ b/examples/cassandra-kubernetes/pom.xml @@ -120,25 +120,31 @@ <!-- Create a Fat JAR --> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-assembly-plugin</artifactId> - <version>${maven-assembly-plugin-version}</version> + <artifactId>maven-shade-plugin</artifactId> + <version>${maven-shade-plugin-version}</version> <configuration> - <descriptorRefs> - <descriptorRef>jar-with-dependencies</descriptorRef> - </descriptorRefs> - <appendAssemblyId>false</appendAssemblyId> - <archive> - <manifest> - <mainClass>${main.class}</mainClass> - </manifest> - </archive> + <transformers> + <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> + <mainClass>${main.class}</mainClass> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/spring.handlers</resource> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/spring.schemas</resource> + </transformer> + <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> + <resource>META-INF/services/org/apache/camel/TypeConverterLoader</resource> + </transformer> + + </transformers> </configuration> <executions> <execution> <id>fat-jar</id> <phase>package</phase> <goals> - <goal>single</goal> + <goal>shade</goal> </goals> </execution> </executions> diff --git a/examples/cassandra-kubernetes/src/main/resources/jkube/cassandra-statefulset.yaml b/examples/cassandra-kubernetes/src/main/resources/jkube/cassandra-statefulset.yaml index fdb16657..bec86fb2 100644 --- a/examples/cassandra-kubernetes/src/main/resources/jkube/cassandra-statefulset.yaml +++ b/examples/cassandra-kubernetes/src/main/resources/jkube/cassandra-statefulset.yaml @@ -19,6 +19,8 @@ apiVersion: "apps/v1" kind: StatefulSet metadata: name: cassandra + labels: + app: cassandra spec: serviceName: cassandra replicas: 2 @@ -32,7 +34,7 @@ spec: spec: containers: - name: cassandra - image: gcr.io/google-samples/cassandra:v12 + image: gcr.io/google-samples/cassandra:v13 imagePullPolicy: Always ports: - containerPort: 7000 @@ -45,7 +47,11 @@ spec: name: cql resources: limits: - cpu: 0.25 + cpu: 1 + memory: 1Gi + requests: + cpu: 1 + memory: 1Gi securityContext: capabilities: add: @@ -53,7 +59,10 @@ spec: lifecycle: preStop: exec: - command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"] + command: + - /bin/bash + - -c + - nodetool drain env: - name: MAX_HEAP_SIZE value: 512M @@ -67,8 +76,6 @@ spec: value: "DC1-K8Demo" - name: CASSANDRA_RACK value: "Rack1-K8Demo" - - name: CASSANDRA_AUTO_BOOTSTRAP - value: "false" - name: POD_IP valueFrom: fieldRef: @@ -79,8 +86,8 @@ spec: - /bin/bash - -c - /ready-probe.sh - initialDelaySeconds: 15 - timeoutSeconds: 5 + initialDelaySeconds: 60 # wait for JMX server to start up + timeoutSeconds: 60 # These volume mounts are persistent. They are like inline claims, # but not exactly because the names need to match exactly one of # the stateful pod volumes. @@ -93,10 +100,16 @@ spec: volumeClaimTemplates: - metadata: name: cassandra-data - annotations: - volume.alpha.kubernetes.io/storage-class: anything spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 1Gi +--- +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + name: fast +provisioner: k8s.io/minikube-hostpath +parameters: + type: pd-ssd diff --git a/examples/cassandra-kubernetes/src/main/resources/log4j.properties b/examples/cassandra-kubernetes/src/main/resources/log4j2.properties similarity index 73% rename from examples/cassandra-kubernetes/src/main/resources/log4j.properties rename to examples/cassandra-kubernetes/src/main/resources/log4j2.properties index 74261863..7483a15c 100644 --- a/examples/cassandra-kubernetes/src/main/resources/log4j.properties +++ b/examples/cassandra-kubernetes/src/main/resources/log4j2.properties @@ -18,12 +18,9 @@ # # The logging properties used # -log4j.rootLogger=INFO, stdout - -# uncomment the next line to debug Camel -#log4j.logger.org.apache.camel=DEBUG - -# CONSOLE appender not used by default -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n +appender.out.type = Console +appender.out.name = out +appender.out.layout.type = PatternLayout +appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n +rootLogger.level = INFO +rootLogger.appenderRef.out.ref = out diff --git a/examples/debezium/pom.xml b/examples/debezium/pom.xml index 2181a601..daf511fd 100644 --- a/examples/debezium/pom.xml +++ b/examples/debezium/pom.xml @@ -114,12 +114,6 @@ <type>test-jar</type> <scope>test</scope> </dependency> - <dependency> - <groupId>com.amazonaws</groupId> - <artifactId>aws-java-sdk-core</artifactId> - <version>1.12.150</version> - <scope>test</scope> - </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-sql</artifactId> diff --git a/examples/debezium/src/main/java/org/apache/camel/example/debezium/DebeziumPgSQLConsumerToKinesis.java b/examples/debezium/src/main/java/org/apache/camel/example/debezium/DebeziumPgSQLConsumerToKinesis.java index 16695277..5252bc0c 100644 --- a/examples/debezium/src/main/java/org/apache/camel/example/debezium/DebeziumPgSQLConsumerToKinesis.java +++ b/examples/debezium/src/main/java/org/apache/camel/example/debezium/DebeziumPgSQLConsumerToKinesis.java @@ -63,10 +63,12 @@ public final class DebeziumPgSQLConsumerToKinesis { + "&databasePort={{debezium.postgres.databasePort}}" + "&databaseUser={{debezium.postgres.databaseUser}}" + "&databasePassword={{debezium.postgres.databasePassword}}" - + "&databaseServerName={{debezium.postgres.databaseServerName}}" + + "&topicPrefix={{debezium.postgres.topicPrefix}}" + "&databaseDbname={{debezium.postgres.databaseDbname}}" + "&schemaIncludeList={{debezium.postgres.schemaIncludeList}}" + "&tableIncludeList={{debezium.postgres.tableIncludeList}}" + + "&replicaIdentityAutosetValues={{debezium.postgres.replica.identity.autoset.values}}" + + "&additionalProperties.notification.enabled.channels=log" + "&offsetStorageFileName={{debezium.postgres.offsetStorageFileName}}") .routeId("FromDebeziumPgSql") // We will need to prepare the data for Kinesis, however we need to mention here is that Kinesis is a bit different from Kafka in terms diff --git a/examples/debezium/src/main/resources/application.properties b/examples/debezium/src/main/resources/application.properties index 85902041..9b6ea0e5 100644 --- a/examples/debezium/src/main/resources/application.properties +++ b/examples/debezium/src/main/resources/application.properties @@ -21,11 +21,12 @@ debezium.postgres.databaseHostName = localhost debezium.postgres.databasePort = 5432 debezium.postgres.databaseUser = debezium debezium.postgres.databasePassword = dbz -debezium.postgres.databaseServerName = debezium-connector-postgres-01 +debezium.postgres.topicPrefix = debezium-connector-postgres-01 debezium.postgres.databaseDbname = debezium-db debezium.postgres.schemaIncludeList = inventory debezium.postgres.tableIncludeList = inventory.products debezium.postgres.offsetStorageFileName = target/offset-01.data +debezium.postgres.replica.identity.autoset.values = inventory.products:FULL kinesis.streamName = camel-debezium-example kinesis.accessKey = generated-access-key @@ -33,4 +34,4 @@ kinesis.secretKey = generated-secret-key kinesis.region = EU_CENTRAL_1 cassandra.node = localhost:9042 -cassandra.keyspace = dbzSink \ No newline at end of file +cassandra.keyspace = dbzSink diff --git a/examples/debezium/src/main/resources/log4j2.properties b/examples/debezium/src/main/resources/log4j2.properties index d406a9f6..3aae1b96 100644 --- a/examples/debezium/src/main/resources/log4j2.properties +++ b/examples/debezium/src/main/resources/log4j2.properties @@ -21,3 +21,15 @@ appender.out.layout.type = PatternLayout appender.out.layout.pattern = %d [%-15.15t] %-5p %-30.30c{1} - %m%n rootLogger.level = INFO rootLogger.appenderRef.out.ref = out + +appender.file.type = File +appender.file.name = NOTIFY +appender.file.fileName=target/notifications.log +appender.file.layout.type=PatternLayout +appender.file.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n +appender.file.append=false + +logger.notify.name=io.debezium.pipeline.notification.channels.LogNotificationChannel +logger.notify.level=INFO +logger.notify.appenderRefs=file +logger.notify.appenderRef.file.ref=NOTIFY diff --git a/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java b/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java index 3a0fefaf..e96a1b53 100644 --- a/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java +++ b/examples/debezium/src/test/java/org/apache/camel/example/debezium/DebeziumTest.java @@ -40,9 +40,12 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.postgresql.ds.PGSimpleDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.testcontainers.containers.CassandraContainer; import org.testcontainers.containers.PostgreSQLContainer; import org.testcontainers.utility.DockerImageName; + import software.amazon.awssdk.services.kinesis.KinesisClient; import software.amazon.awssdk.services.kinesis.model.CreateStreamRequest; @@ -58,13 +61,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue; */ class DebeziumTest extends CamelMainTestSupport { - private static final String PGSQL_IMAGE = "debezium/example-postgres:1.9"; + private static final String PGSQL_IMAGE = "debezium/example-postgres:2.3.2.Final"; private static final String CASSANDRA_IMAGE = "cassandra:4.0.1"; private static final String SOURCE_DB_NAME = "debezium-db"; private static final String SOURCE_DB_SCHEMA = "inventory"; private static final String SOURCE_DB_USERNAME = "pgsql-user"; private static final String SOURCE_DB_PASSWORD = "pgsql-pw"; + private static final Logger LOGGER = LoggerFactory.getLogger(DebeziumTest.class); @RegisterExtension private static final AWSService AWS_SERVICE = AWSServiceFactory.createKinesisService(); @@ -122,23 +126,27 @@ class DebeziumTest extends CamelMainTestSupport { @Test void should_propagate_db_event_thanks_to_debezium() { NotifyBuilder notify = new NotifyBuilder(context).from("aws2-kinesis:*").whenCompleted(3).create(); - + LOGGER.debug("Doing initial select"); List<?> resultSource = template.requestBody("direct:select", null, List.class); assertEquals(9, resultSource.size(), "We should not have additional products in source"); await().atMost(20, SECONDS).until(() -> template.requestBody("direct:result", null, List.class).size(), equalTo(0)); + // Wait until the notification message is written to the logfile + // If the insert is done before the end of the snapshot, no events are received + await().atMost(2, SECONDS).until(() -> snapshotIsDone()); + LOGGER.debug("Doing insert"); template.sendBody("direct:insert", new Object[] { 1, "scooter", "Small 2-wheel yellow scooter", 5.54 }); resultSource = template.requestBody("direct:select", null, List.class); assertEquals(10, resultSource.size(), "We should have one additional product in source"); await().atMost(20, SECONDS).until(() -> template.requestBody("direct:result", null, List.class).size(), equalTo(1)); - + LOGGER.debug("Doing update"); template.sendBody("direct:update", new Object[] { "yellow scooter", 1 }); resultSource = template.requestBody("direct:select", null, List.class); assertEquals(10, resultSource.size(), "We should not have more product in source"); await().atMost(20, SECONDS).until(() -> template.requestBody("direct:result", null, List.class).size(), equalTo(1)); - + LOGGER.debug("Doing delete"); template.sendBody("direct:delete", new Object[] { 1 }); resultSource = template.requestBody("direct:select", null, List.class); @@ -150,6 +158,15 @@ class DebeziumTest extends CamelMainTestSupport { ); } + private boolean snapshotIsDone() { + Path log = Path.of("target/notifications.log"); + try { + return(Files.size(log)>0); + } catch (IOException e) { + return false; + } + } + @Override protected void configure(MainConfigurationProperties configuration) { configuration.addRoutesBuilder(DebeziumPgSQLConsumerToKinesis.createRouteBuilder()); diff --git a/examples/java8/src/main/java/org/apache/camel/example/java8/MyApplication.java b/examples/java8/src/main/java/org/apache/camel/example/java8/MyApplication.java index 32ec7be4..b1770662 100644 --- a/examples/java8/src/main/java/org/apache/camel/example/java8/MyApplication.java +++ b/examples/java8/src/main/java/org/apache/camel/example/java8/MyApplication.java @@ -41,7 +41,7 @@ public final class MyApplication { @Override public void configure() throws Exception { - from("timer:simple?period=503") + from("timer:simple?includeMetadata=true&period=503") .id("simple-route") .transform() .exchange(this::dateToTime) diff --git a/examples/jmx/pom.xml b/examples/jmx/pom.xml index 84234d43..e74e3b4e 100644 --- a/examples/jmx/pom.xml +++ b/examples/jmx/pom.xml @@ -85,14 +85,6 @@ <scope>runtime</scope> </dependency> - <!-- for testing --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>${junit-version}</version> - <scope>test</scope> - </dependency> - <!-- for testing --> <dependency> <groupId>org.apache.camel</groupId> diff --git a/examples/kotlin/pom.xml b/examples/kotlin/pom.xml index 8e3a1511..e042a628 100644 --- a/examples/kotlin/pom.xml +++ b/examples/kotlin/pom.xml @@ -35,7 +35,7 @@ <properties> <category>Other Languages</category> - <kotlin.version>1.6.10</kotlin.version> + <kotlin.version>1.8.0</kotlin.version> </properties> <dependencyManagement> diff --git a/examples/pom.xml b/examples/pom.xml index c2b0a0cd..66bca581 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -177,7 +177,7 @@ <woodstox-version>6.0.3</woodstox-version> <xmlunit-version>1.6</xmlunit-version> <derby-version>10.14.2.0</derby-version> - <jkube-version>1.0.0</jkube-version> + <jkube-version>1.14.0</jkube-version> <wsdl4j-version>1.6.3</wsdl4j-version> <fabric8-maven-plugin-version>4.4.1</fabric8-maven-plugin-version> </properties> diff --git a/examples/spring-pulsar/pom.xml b/examples/spring-pulsar/pom.xml index fb866d44..228e82ed 100644 --- a/examples/spring-pulsar/pom.xml +++ b/examples/spring-pulsar/pom.xml @@ -82,6 +82,12 @@ <version>${log4j2-version}</version> <scope>runtime</scope> </dependency> + + <dependency> + <groupId>jakarta.activation</groupId> + <artifactId>jakarta.activation-api</artifactId> + <version>${jakarta-activation-version}</version> + </dependency> <!-- for testing --> <dependency> diff --git a/examples/spring-xquery/pom.xml b/examples/spring-xquery/pom.xml index 69b37a42..e0ae6c50 100644 --- a/examples/spring-xquery/pom.xml +++ b/examples/spring-xquery/pom.xml @@ -64,6 +64,20 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-file</artifactId> </dependency> + + <!-- logging --> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-core</artifactId> + <version>${log4j2-version}</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j2-impl</artifactId> + <version>${log4j2-version}</version> + <scope>runtime</scope> + </dependency> <!-- xquery support --> <dependency> @@ -78,36 +92,16 @@ </dependency> <dependency> <groupId>org.apache.activemq</groupId> - <artifactId>activemq-broker</artifactId> - <version>${activemq-version}</version> + <artifactId>artemis-jakarta-client</artifactId> + <version>${activemq-artemis-version}</version> </dependency> <dependency> <groupId>org.apache.activemq</groupId> - <artifactId>activemq-client</artifactId> - <version>${activemq-version}</version> - <!-- lets use JMS 2.0 api but camel-jms still works with ActiveMQ 5.x that is JMS 1.1 only --> - <exclusions> - <exclusion> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jms_1.1_spec</artifactId> - </exclusion> - </exclusions> - </dependency> - - <!-- logging --> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-core</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-slf4j2-impl</artifactId> - <version>${log4j2-version}</version> - <scope>runtime</scope> + <artifactId>artemis-jakarta-server</artifactId> + <version>${activemq-artemis-version}</version> </dependency> + <!-- for testing --> <dependency> <groupId>org.apache.camel</groupId> diff --git a/examples/spring-xquery/src/main/resources/META-INF/spring/camelContext.xml b/examples/spring-xquery/src/main/resources/META-INF/spring/camelContext.xml index dc31c85a..764a0d54 100644 --- a/examples/spring-xquery/src/main/resources/META-INF/spring/camelContext.xml +++ b/examples/spring-xquery/src/main/resources/META-INF/spring/camelContext.xml @@ -42,12 +42,17 @@ </route> </camelContext> + + <!-- Start an embedded artemis server, configured with broker.xml --> + <bean id="EmbeddedActiveMQ" class="org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ" + init-method="start" destroy-method="stop"> + </bean> <!-- lets configure the default ActiveMQ broker URL --> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> <property name="connectionFactory"> - <bean class="org.apache.activemq.ActiveMQConnectionFactory"> - <property name="brokerURL" value="vm://localhost?broker.persistent=false"/> + <bean class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory"> + <constructor-arg value="vm://0"/> </bean> </property> </bean> diff --git a/examples/spring-xquery/src/main/resources/broker.xml b/examples/spring-xquery/src/main/resources/broker.xml new file mode 100644 index 00000000..7e9fb13b --- /dev/null +++ b/examples/spring-xquery/src/main/resources/broker.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd"> + <core xmlns="urn:activemq:core"> + + <persistence-enabled>false</persistence-enabled> + <security-enabled>false</security-enabled> + <acceptors> + <acceptor name="in-vm">vm://0</acceptor> + </acceptors> + </core> +</configuration> diff --git a/examples/spring/pom.xml b/examples/spring/pom.xml index 39a6e201..ae824415 100644 --- a/examples/spring/pom.xml +++ b/examples/spring/pom.xml @@ -71,25 +71,7 @@ <groupId>org.apache.camel</groupId> <artifactId>camel-spring-xml</artifactId> </dependency> - - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-broker</artifactId> - <version>${activemq-version}</version> - </dependency> - <dependency> - <groupId>org.apache.activemq</groupId> - <artifactId>activemq-client</artifactId> - <version>${activemq-version}</version> - <!-- lets use JMS 2.0 api but camel-jms still works with ActiveMQ 5.x that is JMS 1.1 only --> - <exclusions> - <exclusion> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-jms_1.1_spec</artifactId> - </exclusion> - </exclusions> - </dependency> - + <!-- logging --> <dependency> <groupId>org.apache.logging.log4j</groupId> @@ -103,6 +85,17 @@ <version>${log4j2-version}</version> <scope>runtime</scope> </dependency> + + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-jakarta-client</artifactId> + <version>${activemq-artemis-version}</version> + </dependency> + <dependency> + <groupId>org.apache.activemq</groupId> + <artifactId>artemis-server</artifactId> + <version>${activemq-artemis-version}</version> + </dependency> <!-- for testing --> <dependency> diff --git a/examples/spring/src/main/resources/META-INF/spring/camel-context.xml b/examples/spring/src/main/resources/META-INF/spring/camel-context.xml index 260b6f26..fce810c2 100644 --- a/examples/spring/src/main/resources/META-INF/spring/camel-context.xml +++ b/examples/spring/src/main/resources/META-INF/spring/camel-context.xml @@ -26,12 +26,17 @@ <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <package>org.apache.camel.example.spring</package> </camelContext> + + <!-- Start an embedded artemis server, configured with broker.xml --> + <bean id="EmbeddedActiveMQ" class="org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ" + init-method="start" destroy-method="stop"> + </bean> <!-- lets configure the default ActiveMQ broker URL --> <bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> <property name="connectionFactory"> - <bean class="org.apache.activemq.ActiveMQConnectionFactory"> - <property name="brokerURL" value="vm://localhost?broker.persistent=false&broker.useJmx=true"/> + <bean class="org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory"> + <constructor-arg value="vm://0"/> </bean> </property> </bean> diff --git a/examples/spring/src/main/resources/broker.xml b/examples/spring/src/main/resources/broker.xml new file mode 100644 index 00000000..7e9fb13b --- /dev/null +++ b/examples/spring/src/main/resources/broker.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> +<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd"> + <core xmlns="urn:activemq:core"> + + <persistence-enabled>false</persistence-enabled> + <security-enabled>false</security-enabled> + <acceptors> + <acceptor name="in-vm">vm://0</acceptor> + </acceptors> + </core> +</configuration>