This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-kamelets.git
The following commit(s) were added to refs/heads/main by this push:
new b8f9bbd21 Fix #3329: new jms-apache-activemq-source and
jms-apache-activemq-sink Kamelets for ActiveMQ Classic (#3342)
b8f9bbd21 is described below
commit b8f9bbd212828c8a415fa4031b29198af4cd0ccb
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 11:12:30 2026 +0100
Fix #3329: new jms-apache-activemq-source and jms-apache-activemq-sink
Kamelets for ActiveMQ Classic (#3342)
* Fix #3329: new jms-apache-activemq-source and jms-apache-activemq-sink
Kamelets for ActiveMQ Classic
The pair follows jms-apache-artemis-source and -sink: the generic jms
component with an
org.apache.activemq.ActiveMQConnectionFactory bean (activemq-client 6.3.2,
the version Camel uses),
pooled-jms on the sink, the same options and the removal of the CamelJms*
headers before the sink
sends. The source has no subscriptionShared option, as ActiveMQ Classic
does not support shared
subscriptions (createSharedConsumer is not supported).
The names existed before Camel 4.0 and were removed with camel-activemq;
the new ones have no
default admin/admin login and no activemq-http dependency.
Citrus tests against apache/activemq-classic:6.2.0 with a login: the sink
(body, header, priority,
persistence, CamelJmsDestinationName ignored, wrong password), the source
(body, headers, selector),
a topic round trip, and transacted redelivery ending in ActiveMQ.DLQ.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* Fix #3329: jms-apache-activemq-source sends an answer only to the
JMSReplyTo of the incoming message (part of #3344)
As in #3344 for the other JMS sources: the source keeps the JMSReplyTo of
the incoming message in a
variable, puts it back after the flow, and removes the CamelJms* headers
the flow set, so headers set
during the flow neither redirect the answer, nor make one for a message
without JMSReplyTo, nor change
the answer. The description says so, and
jms-apache-activemq-source-reply-route tests it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
* chore: regenerate the catalog files after merging main
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y4dDmBDsSWV117kccuNf9
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
---
.../camel-kamelets-catalog-sbom.json | 28 +++-
docs/modules/ROOT/nav.adoc | 2 +
kamelets/jms-apache-activemq-sink.kamelet.yaml | 155 ++++++++++++++++++
kamelets/jms-apache-activemq-source.kamelet.yaml | 174 +++++++++++++++++++++
.../kamelets/catalog/KameletsCatalogTest.java | 2 +
.../main/resources/META-INF/kamelets-index.json | 20 +++
.../kamelets/jms-apache-activemq-sink.kamelet.yaml | 155 ++++++++++++++++++
.../jms-apache-activemq-source.kamelet.yaml | 174 +++++++++++++++++++++
.../src/test/java/MessagingIT.java | 2 +-
.../jms-apache-activemq-sink-route.citrus.it.yaml | 103 ++++++++++++
.../jms/jms-apache-activemq-sink-route.yaml | 84 ++++++++++
...ache-activemq-source-reply-route.citrus.it.yaml | 156 ++++++++++++++++++
.../jms-apache-activemq-source-reply-route.yaml | 93 +++++++++++
...jms-apache-activemq-source-route.citrus.it.yaml | 86 ++++++++++
.../jms/jms-apache-activemq-source-route.yaml | 68 ++++++++
...activemq-source-transacted-route.citrus.it.yaml | 82 ++++++++++
...ms-apache-activemq-source-transacted-route.yaml | 61 ++++++++
.../jms-apache-activemq-topic-route.citrus.it.yaml | 74 +++++++++
.../jms/jms-apache-activemq-topic-route.yaml | 57 +++++++
19 files changed, 1574 insertions(+), 2 deletions(-)
diff --git a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
index f71db6c17..0dd3519b1 100644
--- a/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
+++ b/camel-kamelets-sbom/camel-kamelets-catalog-sbom.json
@@ -621,6 +621,16 @@
"type" : "library",
"name" : "jms-amqp-10-source",
"version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:jms-apache-activemq-sink",
+ "type" : "library",
+ "name" : "jms-apache-activemq-sink",
+ "version" : "4.24.0-SNAPSHOT"
+ }, {
+ "bom-ref" : "kamelet:jms-apache-activemq-source",
+ "type" : "library",
+ "name" : "jms-apache-activemq-source",
+ "version" : "4.24.0-SNAPSHOT"
}, {
"bom-ref" : "kamelet:jms-apache-artemis-sink",
"type" : "library",
@@ -1187,6 +1197,13 @@
"name" : "snowflake-jdbc",
"version" : "4.3.4",
"purl" : "pkg:maven/net.snowflake/[email protected]"
+ }, {
+ "bom-ref" : "pkg:maven/org.apache.activemq/[email protected]",
+ "type" : "library",
+ "group" : "org.apache.activemq",
+ "name" : "activemq-client",
+ "version" : "6.3.2",
+ "purl" : "pkg:maven/org.apache.activemq/[email protected]"
}, {
"bom-ref" :
"pkg:maven/org.apache.activemq/[email protected]",
"type" : "library",
@@ -2435,7 +2452,7 @@
} ],
"dependencies" : [ {
"ref" : "camel-kamelets-catalog",
- "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source",
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
+ "dependsOn" : [ "kamelet:avro-deserialize-action",
"kamelet:avro-serialize-action", "kamelet:aws-bedrock-agent-runtime-sink",
"kamelet:aws-bedrock-agent-sink", "kamelet:aws-bedrock-text-sink",
"kamelet:aws-cloudtrail-source", "kamelet:aws-cloudwatch-sink",
"kamelet:aws-comprehend-sink", "kamelet:aws-ddb-sink",
"kamelet:aws-ddb-streams-source", "kamelet:aws-ec2-sink",
"kamelet:aws-eventbridge-sink", "kamelet:aws-eventbridge-source",
"kamelet:aws-kinesis-firehose-sink", "kamelet:aws-ki [...]
}, {
"ref" : "kamelet:avro-deserialize-action",
"dependsOn" : [
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
@@ -2802,6 +2819,12 @@
}, {
"ref" : "kamelet:jms-amqp-10-source",
"dependsOn" : [ "pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
+ }, {
+ "ref" : "kamelet:jms-apache-activemq-sink",
+ "dependsOn" : [ "pkg:maven/org.apache.activemq/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.messaginghub/[email protected]" ]
+ }, {
+ "ref" : "kamelet:jms-apache-activemq-source",
+ "dependsOn" : [ "pkg:maven/org.apache.activemq/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]" ]
}, {
"ref" : "kamelet:jms-apache-artemis-sink",
"dependsOn" : [
"pkg:maven/org.apache.activemq/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.apache.camel/[email protected]",
"pkg:maven/org.messaginghub/[email protected]" ]
@@ -3138,6 +3161,9 @@
}, {
"ref" : "pkg:maven/net.snowflake/[email protected]",
"dependsOn" : [ ]
+ }, {
+ "ref" : "pkg:maven/org.apache.activemq/[email protected]",
+ "dependsOn" : [ ]
}, {
"ref" : "pkg:maven/org.apache.activemq/[email protected]",
"dependsOn" : [ ]
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index e833e8877..9160f276f 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -121,6 +121,8 @@
* xref:jira-update-issue-sink.adoc[]
* xref:jms-amqp-10-sink.adoc[]
* xref:jms-amqp-10-source.adoc[]
+* xref:jms-apache-activemq-sink.adoc[]
+* xref:jms-apache-activemq-source.adoc[]
* xref:jms-apache-artemis-sink.adoc[]
* xref:jms-apache-artemis-source.adoc[]
* xref:jms-ibm-mq-sink.adoc[]
diff --git a/kamelets/jms-apache-activemq-sink.kamelet.yaml
b/kamelets/jms-apache-activemq-sink.kamelet.yaml
new file mode 100644
index 000000000..596666ad8
--- /dev/null
+++ b/kamelets/jms-apache-activemq-sink.kamelet.yaml
@@ -0,0 +1,155 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: jms-apache-activemq-sink
+ annotations:
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Im
[...]
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.group: "JMS"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "sink"
+ camel.apache.org/kamelet.verified: "true"
+ camel.apache.org/requires.runtime: camel-k
+spec:
+ definition:
+ title: "JMS - Apache ActiveMQ Classic Sink"
+ description: |-
+ Sends each message to a queue or a topic in an Apache ActiveMQ Classic
broker, through JMS over OpenWire.
+
+ Use it to hand work to another application through a queue, such as
orders to process, or to publish events on a topic for every application that
listens. For an Apache ActiveMQ Artemis broker, use `jms-apache-artemis-sink`;
for another broker that speaks AMQP 1.0, use `jms-amqp-10-sink`.
+
+ Input: text is sent as a JMS text message, bytes as a JMS bytes message,
and a Map as a JMS map message; `jmsMessageType` sends text or bytes as the
other kind. The headers of the message, except the Camel ones, are sent along
as JMS properties of the message.
+
+ Output: the message is unchanged, with the name of the queue or topic it
was sent to in the `CamelJMSDestinationProduced` header.
+
+ Good to know: Messages go to a queue unless `destinationType` is
`topic`, and a message sent to a topic reaches only the receivers subscribed at
that moment. Messages are persistent, with priority 4, and never expire, unless
`deliveryPersistent`, `priority` and `timeToLive` say otherwise. It connects
with no TLS unless `brokerURL` starts with `ssl://`, and logs in with
`username` and `password` when they are set; a message fails when the broker
refuses the login, or cannot be reach [...]
+ required:
+ - destinationName
+ - brokerURL
+ type: object
+ properties:
+ destinationType:
+ title: "Queue or Topic"
+ description: "Whether `destinationName` is a queue (`queue`) or a
topic (`topic`). A queue keeps each message until one receiver takes it; a
topic hands each message to every receiver subscribed at that moment."
+ type: string
+ default: queue
+ enum: ["queue", "topic"]
+ destinationName:
+ title: "Queue or Topic Name"
+ description: "The name of the queue or topic to send the messages to."
+ type: string
+ example: "orders"
+ brokerURL:
+ title: "Broker URL"
+ description: "The address of the ActiveMQ Classic broker, as
`tcp://host:port`; the usual port is 61616. Use `ssl://host:port` for TLS, to a
TLS connector of the broker (often on port 61617). For several brokers,
`failover:(tcp://broker1:61616,tcp://broker2:61616)` connects to one of them
and moves to another when it fails; while none can be reached, a message waits
instead of failing."
+ type: string
+ example: "tcp://localhost:61616"
+ username:
+ title: "Broker Username"
+ description: "The user name to log in to the broker with. Leave it
empty for a broker that accepts clients without a login."
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: "Broker Password"
+ description: "The password to log in to the broker with, for the user
`username`."
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ maxSessionsPerConnection:
+ title: "Max Sessions Per Connection"
+ description: "The most sessions that can be open at the same time on
each connection of the pool. Each message being sent or received uses one
session."
+ type: integer
+ default: 500
+ maxIdleSessionsPerConnection:
+ title: "Max Idle Sessions Per Connection"
+ description: "How many unused sessions each connection of the pool
keeps open for reuse. Unused sessions beyond this number are closed."
+ type: integer
+ default: 500
+ connectionIdleTimeout:
+ title: "Connection Idle Timeout"
+ description: "How long a connection of the pool can stay unused before
it is closed, in milliseconds. For example, 30000 is 30 seconds."
+ type: integer
+ default: 30000
+ deliveryPersistent:
+ title: "Persistent Delivery"
+ description: "Whether the broker stores each message on disk, so that
it survives a restart of the broker. False sends non-persistent messages, which
are faster but lost when the broker stops. When it is not set, the messages are
persistent."
+ type: boolean
+ timeToLive:
+ title: "Time to Live"
+ description: "How long each message may wait to be received, in
milliseconds, such as 60000 for one minute. A message still waiting after that
time expires: the broker does not deliver it, and moves a persistent message to
the dead letter queue `ActiveMQ.DLQ` (the default of the broker) and drops a
non-persistent one. When it is not set, the messages never expire."
+ type: integer
+ example: 60000
+ priority:
+ title: "Priority"
+ description: "The JMS priority of each message, from 0 (lowest) to 9
(highest). Of the messages waiting on a queue, the broker delivers those with
the highest priority first. When it is not set, 4."
+ type: integer
+ minimum: 0
+ maximum: 9
+ example: 7
+ jmsMessageType:
+ title: "JMS Message Type"
+ description: "The kind of JMS message to send, whatever the body:
`Text` sends a text message, and `Bytes` a bytes message, for a receiver that
expects one kind. When it is not set, the kind follows the body: text is sent
as a text message, and bytes as a bytes message."
+ type: string
+ enum: ["Text", "Bytes"]
+ dataTypes:
+ # No 'default:' here on purpose: the kind of the body picks the kind of
JMS message (text, bytes
+ # or map), and a default would send every message as one kind. See #3117.
+ in:
+ headers: {}
+ dependencies:
+ - "camel:jms"
+ - "camel:kamelet"
+ - "mvn:org.apache.activemq:activemq-client:6.3.2"
+ - "mvn:org.messaginghub:pooled-jms:3.2.6"
+ template:
+ beans:
+ - name: connectionFactoryBean
+ type: "#class:org.apache.activemq.ActiveMQConnectionFactory"
+ properties:
+ brokerURL: "{{brokerURL}}"
+ userName: "{{?username}}"
+ password: "{{?password}}"
+ - name: pooledFactoryBean
+ type: "#class:org.messaginghub.pooled.jms.JmsPoolConnectionFactory"
+ properties:
+ connectionFactory: "#bean:{{connectionFactoryBean}}"
+ maxSessionsPerConnection: "{{maxSessionsPerConnection}}"
+ maxIdleSessionsPerConnection: "{{maxIdleSessionsPerConnection}}"
+ connectionIdleTimeout: "{{connectionIdleTimeout}}"
+ from:
+ uri: kamelet:source
+ steps:
+ - removeHeaders:
+ pattern: CamelJms*
+ - to:
+ uri: jms
+ pattern: InOnly
+ parameters:
+ destinationType: "{{destinationType}}"
+ destinationName: "{{destinationName}}"
+ deliveryPersistent: "{{?deliveryPersistent}}"
+ timeToLive: "{{?timeToLive}}"
+ priority: "{{?priority}}"
+ jmsMessageType: "{{?jmsMessageType}}"
+ connectionFactory: "#bean:{{pooledFactoryBean}}"
diff --git a/kamelets/jms-apache-activemq-source.kamelet.yaml
b/kamelets/jms-apache-activemq-source.kamelet.yaml
new file mode 100644
index 000000000..0cf13822f
--- /dev/null
+++ b/kamelets/jms-apache-activemq-source.kamelet.yaml
@@ -0,0 +1,174 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: jms-apache-activemq-source
+ annotations:
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Im
[...]
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.group: "JMS"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+ camel.apache.org/requires.runtime: camel-k
+spec:
+ definition:
+ title: "JMS - Apache ActiveMQ Classic Source"
+ description: |-
+ Receives each message from a queue or a topic in an Apache ActiveMQ
Classic broker, through JMS over OpenWire.
+
+ Use it to process work that other applications put on a queue, such as
orders or jobs, or to react to events published on a topic. For an Apache
ActiveMQ Artemis broker, use `jms-apache-artemis-source`; for another broker
that speaks AMQP 1.0, use `jms-amqp-10-source`.
+
+ Output: the body is text for a JMS text message, bytes for a bytes
message, and a Map for a map message. The JMS properties of the message become
headers, along with the JMS headers such as `JMSMessageID`, `JMSDestination`,
`JMSTimestamp`, `JMSPriority` and `JMSRedelivered`.
+
+ Good to know: From a queue, each message is removed when it is received,
even when the rest of the flow then fails, unless `transacted` is true or
`acknowledgementModeName` is `CLIENT_ACKNOWLEDGE`: then a message whose flow
failed is delivered again, up to 6 more times, and then moved to the dead
letter queue `ActiveMQ.DLQ`. Several copies of this source share the messages
of a queue, and `concurrentConsumers` processes several messages at the same
time. From a topic (`destinationT [...]
+ required:
+ - destinationName
+ - brokerURL
+ type: object
+ properties:
+ destinationType:
+ title: "Queue or Topic"
+ description: "Whether `destinationName` is a queue (`queue`) or a
topic (`topic`). A queue keeps each message until one receiver takes it; a
topic hands each message to every receiver subscribed at that moment."
+ type: string
+ default: queue
+ enum: ["queue", "topic"]
+ destinationName:
+ title: "Queue or Topic Name"
+ description: "The name of the queue or topic to receive the messages
from."
+ example: "orders"
+ type: string
+ brokerURL:
+ title: "Broker URL"
+ description: "The address of the ActiveMQ Classic broker, as
`tcp://host:port`; the usual port is 61616. Use `ssl://host:port` for TLS, to a
TLS connector of the broker (often on port 61617). For several brokers,
`failover:(tcp://broker1:61616,tcp://broker2:61616)` connects to one of them,
moves to another when it fails, and keeps trying while none can be reached."
+ type: string
+ example: "tcp://localhost:61616"
+ username:
+ title: "Broker Username"
+ description: "The user name to log in to the broker with. Leave it
empty for a broker that accepts clients without a login."
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: "Broker Password"
+ description: "The password to log in to the broker with, for the user
`username`."
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ clientId:
+ title: "Client ID"
+ description: "The JMS client ID of the connection, which names this
application to the broker. A durable subscription needs one: the broker keeps
the subscription under the client ID and `subscriptionName`, so use the same
client ID each time the source starts; without one, a durable subscription is
refused, and the source logs the error and tries again every 5 seconds. Only
one connection may use a client ID at a time: two running copies of this source
need different client IDs. [...]
+ example: "orders-service"
+ type: string
+ subscriptionDurable:
+ title: "Durable Subscription"
+ description: "Whether the subscription to a topic is durable. When it
is true, the broker keeps the messages sent to the topic while this source is
stopped or disconnected, and delivers them when it connects again; the broker
keeps the subscription, and collects messages for it, until it is removed in
the broker. Set `subscriptionName` and `clientId` with it. When it is false,
the messages sent while the source is not connected are lost. Only for a topic:
true makes `destinationN [...]
+ type: boolean
+ default: false
+ subscriptionName:
+ title: "Subscription Name"
+ description: "The name of the durable subscription to a topic, under
which the broker keeps the subscription, together with `clientId`. Use the same
name each time the source starts, to receive the messages kept while it was
stopped. Set it whenever `subscriptionDurable` is true. Not used otherwise."
+ example: "orders-audit"
+ type: string
+ selector:
+ title: "Message Selector"
+ description: "A JMS message selector: the source receives only the
messages that match it. It is a condition, in a syntax like the WHERE clause of
SQL, on the JMS properties and headers of the message, not on its body, such as
`priority > 5` or `region = 'EU' AND JMSPriority >= 7`. From a queue, the
messages that do not match stay on the queue. When it is not set, the source
receives every message."
+ example: "priority > 5"
+ type: string
+ concurrentConsumers:
+ title: "Concurrent Consumers"
+ description: "How many messages the source processes at the same time,
each in a thread of its own. From a queue, more than one makes the source
faster when each message takes a while, but the messages are then no longer
processed in the order of the queue. On a topic, each consumer is a
subscription of its own and receives every message, so each message is
processed that many times; a durable subscription takes only one consumer. When
it is not set, one message at a time."
+ type: integer
+ example: 5
+ transacted:
+ title: "Transacted"
+ description: "Whether each message is received in a JMS transaction,
which is committed once the rest of the flow has processed the message. When
the flow fails, the transaction is rolled back and the message is delivered
again, with the header `JMSRedelivered` true; after 6 more attempts (the
default of the ActiveMQ client), the broker moves it to the dead letter queue
`ActiveMQ.DLQ`. When it is not set, the message is removed from the queue when
it is received, even when the fl [...]
+ type: boolean
+ acknowledgementModeName:
+ title: "Acknowledgement Mode"
+ description: "When the source acknowledges each message to the broker,
which then removes it from the queue. `AUTO_ACKNOWLEDGE`: as soon as the
message is received. `CLIENT_ACKNOWLEDGE`: once the rest of the flow has
processed it; when the flow fails, the message is delivered again, as with
`transacted`, and moved to the dead letter queue `ActiveMQ.DLQ` after 6 more
attempts. `DUPS_OK_ACKNOWLEDGE`: in batches, which is faster, but the messages
processed since the last batch are d [...]
+ type: string
+ enum: ["AUTO_ACKNOWLEDGE", "CLIENT_ACKNOWLEDGE", "DUPS_OK_ACKNOWLEDGE"]
+ dataTypes:
+ # No 'default:' here on purpose: the kind of JMS message decides whether
the body is text, bytes
+ # or a Map. See #3117.
+ out:
+ headers:
+ JMSMessageID:
+ title: "Message ID"
+ description: "The ID the broker gave the message."
+ type: string
+ JMSDestination:
+ title: "Queue or Topic"
+ description: "The queue or topic the message was received from, such
as `queue://orders` or `topic://prices`."
+ type: string
+ JMSTimestamp:
+ title: "Timestamp"
+ description: "When the message was sent, in milliseconds since
1970-01-01 UTC."
+ type: integer
+ JMSRedelivered:
+ title: "Redelivered"
+ description: "True when the broker delivers the message again, after
an earlier delivery was not acknowledged."
+ type: boolean
+ dependencies:
+ - "camel:jms"
+ - "camel:kamelet"
+ - "mvn:org.apache.activemq:activemq-client:6.3.2"
+ template:
+ beans:
+ - name: connectionFactoryBean
+ type: "#class:org.apache.activemq.ActiveMQConnectionFactory"
+ properties:
+ brokerURL: "{{brokerURL}}"
+ userName: "{{?username}}"
+ password: "{{?password}}"
+ from:
+ uri: jms
+ parameters:
+ destinationType: "{{destinationType}}"
+ destinationName: "{{destinationName}}"
+ subscriptionDurable: "{{subscriptionDurable}}"
+ subscriptionName: "{{?subscriptionName}}"
+ selector: "{{?selector}}"
+ clientId: "{{?clientId}}"
+ concurrentConsumers: "{{?concurrentConsumers}}"
+ transacted: "{{?transacted}}"
+ acknowledgementModeName: "{{?acknowledgementModeName}}"
+ connectionFactory: "#bean:{{connectionFactoryBean}}"
+ steps:
+ # camel-jms sends an answer only to the JMSReplyTo of the incoming
message, chosen before the
+ # flow runs. The flow must not shape the answer either: the JMSReplyTo
header goes back to the
+ # value it had, and no CamelJms* header set by the flow is left to
steer how the answer is sent.
+ - setVariable:
+ name: kameletJmsReplyTo
+ expression:
+ simple:
+ expression: "${header.JMSReplyTo}"
+ - to:
+ uri: kamelet:sink
+ - setHeader:
+ name: JMSReplyTo
+ expression:
+ simple:
+ expression: "${variable.kameletJmsReplyTo}"
+ - removeHeaders:
+ pattern: CamelJms*
diff --git
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
index d4207b4ec..3e7b7c23a 100644
---
a/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
+++
b/library/camel-kamelets-catalog/src/test/java/org/apache/camel/kamelets/catalog/KameletsCatalogTest.java
@@ -249,6 +249,8 @@ public class KameletsCatalogTest {
verifyHeaders("jira-oauth-source", 3);
verifyHeaders("jms-amqp-10-source", 4);
verifyHeaders("jms-amqp-10-sink", 18);
+ verifyHeaders("jms-apache-activemq-source", 4);
+ verifyHeaders("jms-apache-activemq-sink", 18);
verifyHeaders("jms-apache-artemis-source", 4);
verifyHeaders("jms-apache-artemis-sink", 18);
verifyHeaders("jms-ibm-mq-source", 4);
diff --git
a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
index 6fe8205c1..46ed121ba 100644
--- a/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
+++ b/library/camel-kamelets/src/main/resources/META-INF/kamelets-index.json
@@ -1219,6 +1219,26 @@
"group" : "JMS",
"namespace" : "Messaging",
"provider" : "Apache Software Foundation"
+ }, {
+ "name" : "jms-apache-activemq-sink",
+ "type" : "sink",
+ "supportLevel" : "Stable",
+ "title" : "JMS - Apache ActiveMQ Classic Sink",
+ "summary" : "Sends each message to a queue or a topic in an Apache
ActiveMQ Classic broker, through JMS over OpenWire.",
+ "description" : "Sends each message to a queue or a topic in an Apache
ActiveMQ Classic broker, through JMS over OpenWire.\n\nUse it to hand work to
another application through a queue, such as orders to process, or to publish
events on a topic for every application that listens. For an Apache ActiveMQ
Artemis broker, use `jms-apache-artemis-sink`; for another broker that speaks
AMQP 1.0, use `jms-amqp-10-sink`.\n\nInput: text is sent as a JMS text message,
bytes as a JMS bytes messa [...]
+ "group" : "JMS",
+ "namespace" : "Messaging",
+ "provider" : "Apache Software Foundation"
+ }, {
+ "name" : "jms-apache-activemq-source",
+ "type" : "source",
+ "supportLevel" : "Stable",
+ "title" : "JMS - Apache ActiveMQ Classic Source",
+ "summary" : "Receives each message from a queue or a topic in an Apache
ActiveMQ Classic broker, through JMS over OpenWire.",
+ "description" : "Receives each message from a queue or a topic in an
Apache ActiveMQ Classic broker, through JMS over OpenWire.\n\nUse it to process
work that other applications put on a queue, such as orders or jobs, or to
react to events published on a topic. For an Apache ActiveMQ Artemis broker,
use `jms-apache-artemis-source`; for another broker that speaks AMQP 1.0, use
`jms-amqp-10-source`.\n\nOutput: the body is text for a JMS text message, bytes
for a bytes message, and a Ma [...]
+ "group" : "JMS",
+ "namespace" : "Messaging",
+ "provider" : "Apache Software Foundation"
}, {
"name" : "jms-apache-artemis-sink",
"type" : "sink",
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/jms-apache-activemq-sink.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/jms-apache-activemq-sink.kamelet.yaml
new file mode 100644
index 000000000..596666ad8
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/jms-apache-activemq-sink.kamelet.yaml
@@ -0,0 +1,155 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: jms-apache-activemq-sink
+ annotations:
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Im
[...]
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.group: "JMS"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "sink"
+ camel.apache.org/kamelet.verified: "true"
+ camel.apache.org/requires.runtime: camel-k
+spec:
+ definition:
+ title: "JMS - Apache ActiveMQ Classic Sink"
+ description: |-
+ Sends each message to a queue or a topic in an Apache ActiveMQ Classic
broker, through JMS over OpenWire.
+
+ Use it to hand work to another application through a queue, such as
orders to process, or to publish events on a topic for every application that
listens. For an Apache ActiveMQ Artemis broker, use `jms-apache-artemis-sink`;
for another broker that speaks AMQP 1.0, use `jms-amqp-10-sink`.
+
+ Input: text is sent as a JMS text message, bytes as a JMS bytes message,
and a Map as a JMS map message; `jmsMessageType` sends text or bytes as the
other kind. The headers of the message, except the Camel ones, are sent along
as JMS properties of the message.
+
+ Output: the message is unchanged, with the name of the queue or topic it
was sent to in the `CamelJMSDestinationProduced` header.
+
+ Good to know: Messages go to a queue unless `destinationType` is
`topic`, and a message sent to a topic reaches only the receivers subscribed at
that moment. Messages are persistent, with priority 4, and never expire, unless
`deliveryPersistent`, `priority` and `timeToLive` say otherwise. It connects
with no TLS unless `brokerURL` starts with `ssl://`, and logs in with
`username` and `password` when they are set; a message fails when the broker
refuses the login, or cannot be reach [...]
+ required:
+ - destinationName
+ - brokerURL
+ type: object
+ properties:
+ destinationType:
+ title: "Queue or Topic"
+ description: "Whether `destinationName` is a queue (`queue`) or a
topic (`topic`). A queue keeps each message until one receiver takes it; a
topic hands each message to every receiver subscribed at that moment."
+ type: string
+ default: queue
+ enum: ["queue", "topic"]
+ destinationName:
+ title: "Queue or Topic Name"
+ description: "The name of the queue or topic to send the messages to."
+ type: string
+ example: "orders"
+ brokerURL:
+ title: "Broker URL"
+ description: "The address of the ActiveMQ Classic broker, as
`tcp://host:port`; the usual port is 61616. Use `ssl://host:port` for TLS, to a
TLS connector of the broker (often on port 61617). For several brokers,
`failover:(tcp://broker1:61616,tcp://broker2:61616)` connects to one of them
and moves to another when it fails; while none can be reached, a message waits
instead of failing."
+ type: string
+ example: "tcp://localhost:61616"
+ username:
+ title: "Broker Username"
+ description: "The user name to log in to the broker with. Leave it
empty for a broker that accepts clients without a login."
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: "Broker Password"
+ description: "The password to log in to the broker with, for the user
`username`."
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ maxSessionsPerConnection:
+ title: "Max Sessions Per Connection"
+ description: "The most sessions that can be open at the same time on
each connection of the pool. Each message being sent or received uses one
session."
+ type: integer
+ default: 500
+ maxIdleSessionsPerConnection:
+ title: "Max Idle Sessions Per Connection"
+ description: "How many unused sessions each connection of the pool
keeps open for reuse. Unused sessions beyond this number are closed."
+ type: integer
+ default: 500
+ connectionIdleTimeout:
+ title: "Connection Idle Timeout"
+ description: "How long a connection of the pool can stay unused before
it is closed, in milliseconds. For example, 30000 is 30 seconds."
+ type: integer
+ default: 30000
+ deliveryPersistent:
+ title: "Persistent Delivery"
+ description: "Whether the broker stores each message on disk, so that
it survives a restart of the broker. False sends non-persistent messages, which
are faster but lost when the broker stops. When it is not set, the messages are
persistent."
+ type: boolean
+ timeToLive:
+ title: "Time to Live"
+ description: "How long each message may wait to be received, in
milliseconds, such as 60000 for one minute. A message still waiting after that
time expires: the broker does not deliver it, and moves a persistent message to
the dead letter queue `ActiveMQ.DLQ` (the default of the broker) and drops a
non-persistent one. When it is not set, the messages never expire."
+ type: integer
+ example: 60000
+ priority:
+ title: "Priority"
+ description: "The JMS priority of each message, from 0 (lowest) to 9
(highest). Of the messages waiting on a queue, the broker delivers those with
the highest priority first. When it is not set, 4."
+ type: integer
+ minimum: 0
+ maximum: 9
+ example: 7
+ jmsMessageType:
+ title: "JMS Message Type"
+ description: "The kind of JMS message to send, whatever the body:
`Text` sends a text message, and `Bytes` a bytes message, for a receiver that
expects one kind. When it is not set, the kind follows the body: text is sent
as a text message, and bytes as a bytes message."
+ type: string
+ enum: ["Text", "Bytes"]
+ dataTypes:
+ # No 'default:' here on purpose: the kind of the body picks the kind of
JMS message (text, bytes
+ # or map), and a default would send every message as one kind. See #3117.
+ in:
+ headers: {}
+ dependencies:
+ - "camel:jms"
+ - "camel:kamelet"
+ - "mvn:org.apache.activemq:activemq-client:6.3.2"
+ - "mvn:org.messaginghub:pooled-jms:3.2.6"
+ template:
+ beans:
+ - name: connectionFactoryBean
+ type: "#class:org.apache.activemq.ActiveMQConnectionFactory"
+ properties:
+ brokerURL: "{{brokerURL}}"
+ userName: "{{?username}}"
+ password: "{{?password}}"
+ - name: pooledFactoryBean
+ type: "#class:org.messaginghub.pooled.jms.JmsPoolConnectionFactory"
+ properties:
+ connectionFactory: "#bean:{{connectionFactoryBean}}"
+ maxSessionsPerConnection: "{{maxSessionsPerConnection}}"
+ maxIdleSessionsPerConnection: "{{maxIdleSessionsPerConnection}}"
+ connectionIdleTimeout: "{{connectionIdleTimeout}}"
+ from:
+ uri: kamelet:source
+ steps:
+ - removeHeaders:
+ pattern: CamelJms*
+ - to:
+ uri: jms
+ pattern: InOnly
+ parameters:
+ destinationType: "{{destinationType}}"
+ destinationName: "{{destinationName}}"
+ deliveryPersistent: "{{?deliveryPersistent}}"
+ timeToLive: "{{?timeToLive}}"
+ priority: "{{?priority}}"
+ jmsMessageType: "{{?jmsMessageType}}"
+ connectionFactory: "#bean:{{pooledFactoryBean}}"
diff --git
a/library/camel-kamelets/src/main/resources/kamelets/jms-apache-activemq-source.kamelet.yaml
b/library/camel-kamelets/src/main/resources/kamelets/jms-apache-activemq-source.kamelet.yaml
new file mode 100644
index 000000000..0cf13822f
--- /dev/null
+++
b/library/camel-kamelets/src/main/resources/kamelets/jms-apache-activemq-source.kamelet.yaml
@@ -0,0 +1,174 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+apiVersion: camel.apache.org/v1
+kind: Kamelet
+metadata:
+ name: jms-apache-activemq-source
+ annotations:
+ camel.apache.org/kamelet.icon:
"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgoKPHN2ZwogICB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiCiAgIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyIKICAgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM9Im
[...]
+ camel.apache.org/kamelet.support.level: "Stable"
+ camel.apache.org/provider: "Apache Software Foundation"
+ camel.apache.org/catalog.version: "4.24.0-SNAPSHOT"
+ camel.apache.org/kamelet.group: "JMS"
+ camel.apache.org/kamelet.namespace: "Messaging"
+ labels:
+ camel.apache.org/kamelet.type: "source"
+ camel.apache.org/kamelet.verified: "true"
+ camel.apache.org/requires.runtime: camel-k
+spec:
+ definition:
+ title: "JMS - Apache ActiveMQ Classic Source"
+ description: |-
+ Receives each message from a queue or a topic in an Apache ActiveMQ
Classic broker, through JMS over OpenWire.
+
+ Use it to process work that other applications put on a queue, such as
orders or jobs, or to react to events published on a topic. For an Apache
ActiveMQ Artemis broker, use `jms-apache-artemis-source`; for another broker
that speaks AMQP 1.0, use `jms-amqp-10-source`.
+
+ Output: the body is text for a JMS text message, bytes for a bytes
message, and a Map for a map message. The JMS properties of the message become
headers, along with the JMS headers such as `JMSMessageID`, `JMSDestination`,
`JMSTimestamp`, `JMSPriority` and `JMSRedelivered`.
+
+ Good to know: From a queue, each message is removed when it is received,
even when the rest of the flow then fails, unless `transacted` is true or
`acknowledgementModeName` is `CLIENT_ACKNOWLEDGE`: then a message whose flow
failed is delivered again, up to 6 more times, and then moved to the dead
letter queue `ActiveMQ.DLQ`. Several copies of this source share the messages
of a queue, and `concurrentConsumers` processes several messages at the same
time. From a topic (`destinationT [...]
+ required:
+ - destinationName
+ - brokerURL
+ type: object
+ properties:
+ destinationType:
+ title: "Queue or Topic"
+ description: "Whether `destinationName` is a queue (`queue`) or a
topic (`topic`). A queue keeps each message until one receiver takes it; a
topic hands each message to every receiver subscribed at that moment."
+ type: string
+ default: queue
+ enum: ["queue", "topic"]
+ destinationName:
+ title: "Queue or Topic Name"
+ description: "The name of the queue or topic to receive the messages
from."
+ example: "orders"
+ type: string
+ brokerURL:
+ title: "Broker URL"
+ description: "The address of the ActiveMQ Classic broker, as
`tcp://host:port`; the usual port is 61616. Use `ssl://host:port` for TLS, to a
TLS connector of the broker (often on port 61617). For several brokers,
`failover:(tcp://broker1:61616,tcp://broker2:61616)` connects to one of them,
moves to another when it fails, and keeps trying while none can be reached."
+ type: string
+ example: "tcp://localhost:61616"
+ username:
+ title: "Broker Username"
+ description: "The user name to log in to the broker with. Leave it
empty for a broker that accepts clients without a login."
+ type: string
+ x-descriptors:
+ - urn:camel:group:credentials
+ password:
+ title: "Broker Password"
+ description: "The password to log in to the broker with, for the user
`username`."
+ type: string
+ format: password
+ x-descriptors:
+ - urn:camel:group:credentials
+ clientId:
+ title: "Client ID"
+ description: "The JMS client ID of the connection, which names this
application to the broker. A durable subscription needs one: the broker keeps
the subscription under the client ID and `subscriptionName`, so use the same
client ID each time the source starts; without one, a durable subscription is
refused, and the source logs the error and tries again every 5 seconds. Only
one connection may use a client ID at a time: two running copies of this source
need different client IDs. [...]
+ example: "orders-service"
+ type: string
+ subscriptionDurable:
+ title: "Durable Subscription"
+ description: "Whether the subscription to a topic is durable. When it
is true, the broker keeps the messages sent to the topic while this source is
stopped or disconnected, and delivers them when it connects again; the broker
keeps the subscription, and collects messages for it, until it is removed in
the broker. Set `subscriptionName` and `clientId` with it. When it is false,
the messages sent while the source is not connected are lost. Only for a topic:
true makes `destinationN [...]
+ type: boolean
+ default: false
+ subscriptionName:
+ title: "Subscription Name"
+ description: "The name of the durable subscription to a topic, under
which the broker keeps the subscription, together with `clientId`. Use the same
name each time the source starts, to receive the messages kept while it was
stopped. Set it whenever `subscriptionDurable` is true. Not used otherwise."
+ example: "orders-audit"
+ type: string
+ selector:
+ title: "Message Selector"
+ description: "A JMS message selector: the source receives only the
messages that match it. It is a condition, in a syntax like the WHERE clause of
SQL, on the JMS properties and headers of the message, not on its body, such as
`priority > 5` or `region = 'EU' AND JMSPriority >= 7`. From a queue, the
messages that do not match stay on the queue. When it is not set, the source
receives every message."
+ example: "priority > 5"
+ type: string
+ concurrentConsumers:
+ title: "Concurrent Consumers"
+ description: "How many messages the source processes at the same time,
each in a thread of its own. From a queue, more than one makes the source
faster when each message takes a while, but the messages are then no longer
processed in the order of the queue. On a topic, each consumer is a
subscription of its own and receives every message, so each message is
processed that many times; a durable subscription takes only one consumer. When
it is not set, one message at a time."
+ type: integer
+ example: 5
+ transacted:
+ title: "Transacted"
+ description: "Whether each message is received in a JMS transaction,
which is committed once the rest of the flow has processed the message. When
the flow fails, the transaction is rolled back and the message is delivered
again, with the header `JMSRedelivered` true; after 6 more attempts (the
default of the ActiveMQ client), the broker moves it to the dead letter queue
`ActiveMQ.DLQ`. When it is not set, the message is removed from the queue when
it is received, even when the fl [...]
+ type: boolean
+ acknowledgementModeName:
+ title: "Acknowledgement Mode"
+ description: "When the source acknowledges each message to the broker,
which then removes it from the queue. `AUTO_ACKNOWLEDGE`: as soon as the
message is received. `CLIENT_ACKNOWLEDGE`: once the rest of the flow has
processed it; when the flow fails, the message is delivered again, as with
`transacted`, and moved to the dead letter queue `ActiveMQ.DLQ` after 6 more
attempts. `DUPS_OK_ACKNOWLEDGE`: in batches, which is faster, but the messages
processed since the last batch are d [...]
+ type: string
+ enum: ["AUTO_ACKNOWLEDGE", "CLIENT_ACKNOWLEDGE", "DUPS_OK_ACKNOWLEDGE"]
+ dataTypes:
+ # No 'default:' here on purpose: the kind of JMS message decides whether
the body is text, bytes
+ # or a Map. See #3117.
+ out:
+ headers:
+ JMSMessageID:
+ title: "Message ID"
+ description: "The ID the broker gave the message."
+ type: string
+ JMSDestination:
+ title: "Queue or Topic"
+ description: "The queue or topic the message was received from, such
as `queue://orders` or `topic://prices`."
+ type: string
+ JMSTimestamp:
+ title: "Timestamp"
+ description: "When the message was sent, in milliseconds since
1970-01-01 UTC."
+ type: integer
+ JMSRedelivered:
+ title: "Redelivered"
+ description: "True when the broker delivers the message again, after
an earlier delivery was not acknowledged."
+ type: boolean
+ dependencies:
+ - "camel:jms"
+ - "camel:kamelet"
+ - "mvn:org.apache.activemq:activemq-client:6.3.2"
+ template:
+ beans:
+ - name: connectionFactoryBean
+ type: "#class:org.apache.activemq.ActiveMQConnectionFactory"
+ properties:
+ brokerURL: "{{brokerURL}}"
+ userName: "{{?username}}"
+ password: "{{?password}}"
+ from:
+ uri: jms
+ parameters:
+ destinationType: "{{destinationType}}"
+ destinationName: "{{destinationName}}"
+ subscriptionDurable: "{{subscriptionDurable}}"
+ subscriptionName: "{{?subscriptionName}}"
+ selector: "{{?selector}}"
+ clientId: "{{?clientId}}"
+ concurrentConsumers: "{{?concurrentConsumers}}"
+ transacted: "{{?transacted}}"
+ acknowledgementModeName: "{{?acknowledgementModeName}}"
+ connectionFactory: "#bean:{{connectionFactoryBean}}"
+ steps:
+ # camel-jms sends an answer only to the JMSReplyTo of the incoming
message, chosen before the
+ # flow runs. The flow must not shape the answer either: the JMSReplyTo
header goes back to the
+ # value it had, and no CamelJms* header set by the flow is left to
steer how the answer is sent.
+ - setVariable:
+ name: kameletJmsReplyTo
+ expression:
+ simple:
+ expression: "${header.JMSReplyTo}"
+ - to:
+ uri: kamelet:sink
+ - setHeader:
+ name: JMSReplyTo
+ expression:
+ simple:
+ expression: "${variable.kameletJmsReplyTo}"
+ - removeHeaders:
+ pattern: CamelJms*
diff --git a/tests/camel-kamelets-itest/src/test/java/MessagingIT.java
b/tests/camel-kamelets-itest/src/test/java/MessagingIT.java
index e8876cf57..8cb7f948d 100644
--- a/tests/camel-kamelets-itest/src/test/java/MessagingIT.java
+++ b/tests/camel-kamelets-itest/src/test/java/MessagingIT.java
@@ -33,7 +33,7 @@ import static
org.citrusframework.http.endpoint.builder.HttpEndpoints.http;
/**
* Tests of the messaging Kamelets, each against a broker in a container:
Apache ActiveMQ Artemis (for the
- * Artemis and the AMQP 1.0 Kamelets), IBM MQ, RabbitMQ, Apache Pulsar and the
SMPPSim SMS center.
+ * Artemis and the AMQP 1.0 Kamelets), Apache ActiveMQ Classic, IBM MQ,
RabbitMQ, Apache Pulsar and the SMPPSim SMS center.
*/
@CitrusSupport
public class MessagingIT {
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-sink-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-sink-route.citrus.it.yaml
new file mode 100644
index 000000000..eafdf1b14
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-sink-route.citrus.it.yaml
@@ -0,0 +1,103 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: jms-apache-activemq-sink-route-test
+description: 'jms-apache-activemq-sink sends a text message, with its headers
as JMS properties, to a queue in ActiveMQ Classic, ignores a
CamelJmsDestinationName header, and fails with a wrong password'
+actions:
+ # Start ActiveMQ Classic, with a login for the clients
+ - testcontainers:
+ start:
+ container:
+ name: "activemq"
+ image: "apache/activemq-classic:6.2.0"
+ autoRemove: true
+ startUpTimeout: 180
+ exposedPorts:
+ - 61616
+ env:
+ - name: "ACTIVEMQ_CONNECTION_USER"
+ value: "amq"
+ - name: "ACTIVEMQ_CONNECTION_PASSWORD"
+ value: "amqpass"
+ waitFor:
+ logMessage: '.*Apache ActiveMQ [0-9.]+ \(localhost, .*\) started.*'
+
+ # Create Camel JBang integration
+ - camel:
+ cli:
+ run:
+ waitForRunningState: false
+ integration:
+ file: "jms/jms-apache-activemq-sink-route.yaml"
+ systemProperties:
+ properties:
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - name: "classic.broker.url"
+ value:
"tcp://${CITRUS_TESTCONTAINERS_ACTIVEMQ_HOST}:${CITRUS_TESTCONTAINERS_ACTIVEMQ_PORT}"
+
+ # The message goes on unchanged after the Kamelet, to the queue of the
Kamelet and not to the one in the header
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Body-Type"
+ value: 'java.lang.String'
+ - name: "X-Content-Type"
+ value: 'ct='
+ - name: "X-Destination-Produced"
+ value: 'orders'
+ - name: "origin"
+ value: 'citrus'
+ body:
+ data: 'Hello ActiveMQ'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # A wrong password makes the message fail
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/error"
+ type: "plaintext"
+ body:
+ data: '@contains(User name [amq] or password is invalid)@'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # The message is on the queue: persistent (delivery mode 2), with priority 4
and the header as a JMS property
+ - camel:
+ cli:
+ verify:
+ integration: "jms-apache-activemq-sink-route"
+ logMessage: 'Received from the queue: Hello ActiveMQ (origin=citrus,
JMSPriority=4, JMSDeliveryMode=2, JMSDestination=queue://orders)'
+ maxAttempts: 30
+ delayBetweenAttempts: 1000
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-sink-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-sink-route.yaml
new file mode 100644
index 000000000..a95094c73
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-sink-route.yaml
@@ -0,0 +1,84 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+ from:
+ uri: "timer:send"
+ parameters:
+ repeatCount: 1
+ steps:
+ - setBody:
+ constant: 'Hello ActiveMQ'
+ - setHeader:
+ name: origin
+ constant: 'citrus'
+ # a header that would send the message to another queue: the Kamelet
removes it
+ - setHeader:
+ name: CamelJmsDestinationName
+ constant: 'elsewhere'
+ - to:
+ uri: "kamelet:jms-apache-activemq-sink"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'orders'
+ username: 'amq'
+ password: 'amqpass'
+ # what the Kamelet gives: the Java type of the body and the
Content-Type
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
+ - setHeader:
+ name: X-Destination-Produced
+ simple: "${header.CamelJMSDestinationProduced}"
+ - to:
+ uri: "{{http.sink.url}}/result"
+ # the same message with a wrong password
+ - removeHeaders:
+ pattern: '*'
+ - doTry:
+ steps:
+ - to:
+ uri: "kamelet:jms-apache-activemq-sink"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'orders'
+ username: 'amq'
+ password: 'wrong'
+ doCatch:
+ - exception:
+ - java.lang.Exception
+ steps:
+ - setBody:
+ simple: "${exception.message}"
+ - to:
+ uri: "{{http.sink.url}}/error"
+
+# reads the message back from the queue, to show that it arrived
+- route:
+ from:
+ uri: "kamelet:jms-apache-activemq-source"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'orders'
+ username: 'amq'
+ password: 'amqpass'
+ steps:
+ - log:
+ message: 'Received from the queue: ${body}
(origin=${header.origin}, JMSPriority=${header.JMSPriority},
JMSDeliveryMode=${header.JMSDeliveryMode},
JMSDestination=${header.JMSDestination})'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-reply-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-reply-route.citrus.it.yaml
new file mode 100644
index 000000000..9320867b4
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-reply-route.citrus.it.yaml
@@ -0,0 +1,156 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: jms-apache-activemq-source-reply-route-test
+description: 'jms-apache-activemq-source sends the answer only to the
JMSReplyTo of the incoming message, in ActiveMQ Classic: headers set in the
flow neither send it to another queue nor make one for a message without
JMSReplyTo'
+actions:
+ # Start ActiveMQ Classic, with a login for the clients
+ - testcontainers:
+ start:
+ container:
+ name: "activemq"
+ image: "apache/activemq-classic:6.2.0"
+ autoRemove: true
+ startUpTimeout: 180
+ exposedPorts:
+ - 61616
+ env:
+ - name: "ACTIVEMQ_CONNECTION_USER"
+ value: "amq"
+ - name: "ACTIVEMQ_CONNECTION_PASSWORD"
+ value: "amqpass"
+ waitFor:
+ logMessage: '.*Apache ActiveMQ [0-9.]+ \(localhost, .*\) started.*'
+
+ # Create Camel JBang integration
+ - camel:
+ cli:
+ run:
+ waitForRunningState: false
+ args:
+ - "--dep=mvn:org.apache.activemq:activemq-client:6.3.2"
+ integration:
+ file: "jms/jms-apache-activemq-source-reply-route.yaml"
+ systemProperties:
+ properties:
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - name: "classic.broker.url"
+ value:
"tcp://${CITRUS_TESTCONTAINERS_ACTIVEMQ_HOST}:${CITRUS_TESTCONTAINERS_ACTIVEMQ_PORT}"
+
+ # Request 1 names a queue to reply to; the flow sets JMSReplyTo and
CamelJmsDestinationName to another queue
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/request"
+ type: "plaintext"
+ body:
+ data: 'request 1'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ # The answer goes back to the JMSReplyTo of the request, with the JMSReplyTo
of the request, not the one the flow set
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/reply"
+ type: "plaintext"
+ headers:
+ - name: "X-Reply-To"
+ value: '@contains(replies)@'
+ body:
+ data: 'answer to request 1'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ # Request 2 has no JMSReplyTo; the flow sets the same headers
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/request"
+ type: "plaintext"
+ body:
+ data: 'request 2'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ # Request 3 names a queue to reply to again, so request 2 is done
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/request"
+ type: "plaintext"
+ body:
+ data: 'request 3'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ # The answer to request 3
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/reply"
+ type: "plaintext"
+ headers:
+ - name: "X-Reply-To"
+ value: '@contains(replies)@'
+ body:
+ data: 'answer to request 3'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+ # Nothing reached the queue named by the headers of the flow
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/elsewhere"
+ type: "plaintext"
+ body:
+ data: 'nothing'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-reply-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-reply-route.yaml
new file mode 100644
index 000000000..69c864a0e
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-reply-route.yaml
@@ -0,0 +1,93 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+# an application that sends requests and waits for the replies
+- beans:
+ - name: requester
+ type: "org.apache.activemq.ActiveMQConnectionFactory"
+ properties:
+ brokerURL: '{{classic.broker.url}}'
+ userName: 'amq'
+ password: 'amqpass'
+
+- route:
+ from:
+ uri: "kamelet:jms-apache-activemq-source"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'requests'
+ username: 'amq'
+ password: 'amqpass'
+ steps:
+ - setProperty:
+ name: request
+ simple: "${body}"
+ - to:
+ uri: "{{http.sink.url}}/request"
+ # headers that name another queue: they must not change where the
answer goes, nor make one
+ - setHeader:
+ name: JMSReplyTo
+ constant: 'elsewhere'
+ - setHeader:
+ name: CamelJmsDestinationName
+ constant: 'elsewhere'
+ - setBody:
+ simple: 'answer to ${exchangeProperty.request}'
+
+# an application that sends requests: 1 and 3 wait for the answer on the queue
replies, 2 expects none
+- route:
+ from:
+ uri: "timer:send"
+ parameters:
+ repeatCount: 1
+ steps:
+ - setBody:
+ constant: 'request 1'
+ - to:
+ uri:
"jms:queue:requests?connectionFactory=#requester&exchangePattern=InOut&replyTo=replies&requestTimeout=30000"
+ - setHeader:
+ name: X-Reply-To
+ simple: "rt=${header.JMSReplyTo}"
+ - to:
+ uri: "{{http.sink.url}}/reply"
+ - removeHeaders:
+ pattern: '*'
+ - setBody:
+ constant: 'request 2'
+ - to:
+ uri:
"jms:queue:requests?connectionFactory=#requester&exchangePattern=InOnly"
+ - setBody:
+ constant: 'request 3'
+ - to:
+ uri:
"jms:queue:requests?connectionFactory=#requester&exchangePattern=InOut&replyTo=replies&requestTimeout=30000"
+ - setHeader:
+ name: X-Reply-To
+ simple: "rt=${header.JMSReplyTo}"
+ - to:
+ uri: "{{http.sink.url}}/reply"
+ # what reached the queue named by the headers of the flow
+ - removeHeaders:
+ pattern: '*'
+ - setBody:
+ constant: 'nothing'
+ - pollEnrich:
+ constant: "jms:queue:elsewhere?connectionFactory=#requester"
+ timeout: 3000
+ - setBody:
+ simple: "${body} ?: 'nothing'"
+ - to:
+ uri: "{{http.sink.url}}/elsewhere"
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-route.citrus.it.yaml
new file mode 100644
index 000000000..551e24221
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-route.citrus.it.yaml
@@ -0,0 +1,86 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: jms-apache-activemq-source-route-test
+description: 'jms-apache-activemq-source receives a text message that matches
its selector, with its JMS properties and JMS headers as headers, from a queue
in ActiveMQ Classic'
+actions:
+ # Start ActiveMQ Classic, with a login for the clients
+ - testcontainers:
+ start:
+ container:
+ name: "activemq"
+ image: "apache/activemq-classic:6.2.0"
+ autoRemove: true
+ startUpTimeout: 180
+ exposedPorts:
+ - 61616
+ env:
+ - name: "ACTIVEMQ_CONNECTION_USER"
+ value: "amq"
+ - name: "ACTIVEMQ_CONNECTION_PASSWORD"
+ value: "amqpass"
+ waitFor:
+ logMessage: '.*Apache ActiveMQ [0-9.]+ \(localhost, .*\) started.*'
+
+ # Create Camel JBang integration
+ - camel:
+ cli:
+ run:
+ waitForRunningState: false
+ integration:
+ file: "jms/jms-apache-activemq-source-route.yaml"
+ systemProperties:
+ properties:
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - name: "classic.broker.url"
+ value:
"tcp://${CITRUS_TESTCONTAINERS_ACTIVEMQ_HOST}:${CITRUS_TESTCONTAINERS_ACTIVEMQ_PORT}"
+
+ # The source gives the text, the JMS property and the JMS headers, of the
message that matches the selector only
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "X-Body-Type"
+ value: 'java.lang.String'
+ - name: "X-Content-Type"
+ value: 'ct='
+ - name: "region"
+ value: 'EU'
+ - name: "JMSMessageID"
+ value: '@startsWith(ID:)@'
+ - name: "JMSDestination"
+ value: 'queue://orders'
+ - name: "JMSTimestamp"
+ value: '@matches([0-9]+)@'
+ - name: "JMSPriority"
+ value: '4'
+ - name: "JMSRedelivered"
+ value: 'false'
+ body:
+ data: 'Hello ActiveMQ'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-route.yaml
new file mode 100644
index 000000000..71aa0f01f
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-route.yaml
@@ -0,0 +1,68 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+ from:
+ uri: "kamelet:jms-apache-activemq-source"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'orders'
+ username: 'amq'
+ password: 'amqpass'
+ selector: "region = 'EU'"
+ steps:
+ # what the Kamelet gives: the Java type of the body and the
Content-Type
+ - setHeader:
+ name: X-Body-Type
+ simple: "${body.getClass().getName()}"
+ - setHeader:
+ name: X-Content-Type
+ simple: "ct=${header.Content-Type}"
+ - to:
+ uri: "{{http.sink.url}}/result"
+
+# puts two messages on the queue: the source receives only the second one,
which matches the selector
+- route:
+ from:
+ uri: "timer:send"
+ parameters:
+ repeatCount: 1
+ steps:
+ - setBody:
+ constant: 'Hello US'
+ - setHeader:
+ name: region
+ constant: 'US'
+ - to:
+ uri: "kamelet:jms-apache-activemq-sink"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'orders'
+ username: 'amq'
+ password: 'amqpass'
+ - setBody:
+ constant: 'Hello ActiveMQ'
+ - setHeader:
+ name: region
+ constant: 'EU'
+ - to:
+ uri: "kamelet:jms-apache-activemq-sink"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'orders'
+ username: 'amq'
+ password: 'amqpass'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-transacted-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-transacted-route.citrus.it.yaml
new file mode 100644
index 000000000..b3038d820
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-transacted-route.citrus.it.yaml
@@ -0,0 +1,82 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: jms-apache-activemq-source-transacted-route-test
+description: 'jms-apache-activemq-source with transacted true receives a
message again each time its flow fails, 7 times in all, and the broker then
moves it to the dead letter queue ActiveMQ.DLQ'
+actions:
+ # Start ActiveMQ Classic, with a login for the clients
+ - testcontainers:
+ start:
+ container:
+ name: "activemq"
+ image: "apache/activemq-classic:6.2.0"
+ autoRemove: true
+ startUpTimeout: 180
+ exposedPorts:
+ - 61616
+ env:
+ - name: "ACTIVEMQ_CONNECTION_USER"
+ value: "amq"
+ - name: "ACTIVEMQ_CONNECTION_PASSWORD"
+ value: "amqpass"
+ waitFor:
+ logMessage: '.*Apache ActiveMQ [0-9.]+ \(localhost, .*\) started.*'
+
+ # Create Camel JBang integration
+ - camel:
+ cli:
+ run:
+ waitForRunningState: false
+ integration:
+ file: "jms/jms-apache-activemq-source-transacted-route.yaml"
+ systemProperties:
+ properties:
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - name: "classic.broker.url"
+ value:
"tcp://${CITRUS_TESTCONTAINERS_ACTIVEMQ_HOST}:${CITRUS_TESTCONTAINERS_ACTIVEMQ_PORT}"
+
+ # After the last attempt, the message is on the dead letter queue
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/dlq"
+ type: "plaintext"
+ headers:
+ - name: "JMSDestination"
+ value: 'queue://ActiveMQ.DLQ'
+ - name: "dlqDeliveryFailureCause"
+ value: '@contains(Delivery[7] exceeds redelivery policy limit)@'
+ body:
+ data: 'Hello ActiveMQ'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
+ # The flow saw the message 7 times, the last 6 as a redelivery
+ - camel:
+ cli:
+ verify:
+ integration: "jms-apache-activemq-source-transacted-route"
+ logMessage: 'Attempt 7: Hello ActiveMQ (JMSRedelivered=true)'
+ maxAttempts: 30
+ delayBetweenAttempts: 1000
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-transacted-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-transacted-route.yaml
new file mode 100644
index 000000000..de82dc0a1
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-source-transacted-route.yaml
@@ -0,0 +1,61 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+ from:
+ uri: "kamelet:jms-apache-activemq-source"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'payments'
+ username: 'amq'
+ password: 'amqpass'
+ transacted: true
+ steps:
+ - log:
+ message: 'Attempt ${header.JMSXDeliveryCount}: ${body}
(JMSRedelivered=${header.JMSRedelivered})'
+ - throwException:
+ exceptionType: java.lang.IllegalStateException
+ message: 'the flow fails'
+
+# reads the dead letter queue of the broker
+- route:
+ from:
+ uri: "kamelet:jms-apache-activemq-source"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'ActiveMQ.DLQ'
+ username: 'amq'
+ password: 'amqpass'
+ steps:
+ - to:
+ uri: "{{http.sink.url}}/dlq"
+
+- route:
+ from:
+ uri: "timer:send"
+ parameters:
+ repeatCount: 1
+ steps:
+ - setBody:
+ constant: 'Hello ActiveMQ'
+ - to:
+ uri: "kamelet:jms-apache-activemq-sink"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationName: 'payments'
+ username: 'amq'
+ password: 'amqpass'
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-topic-route.citrus.it.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-topic-route.citrus.it.yaml
new file mode 100644
index 000000000..65623eea7
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-topic-route.citrus.it.yaml
@@ -0,0 +1,74 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+name: jms-apache-activemq-topic-route-test
+description: 'jms-apache-activemq-sink publishes a text message on a topic in
ActiveMQ Classic, and jms-apache-activemq-source subscribed to the topic
receives it'
+actions:
+ # Start ActiveMQ Classic, with a login for the clients
+ - testcontainers:
+ start:
+ container:
+ name: "activemq"
+ image: "apache/activemq-classic:6.2.0"
+ autoRemove: true
+ startUpTimeout: 180
+ exposedPorts:
+ - 61616
+ env:
+ - name: "ACTIVEMQ_CONNECTION_USER"
+ value: "amq"
+ - name: "ACTIVEMQ_CONNECTION_PASSWORD"
+ value: "amqpass"
+ waitFor:
+ logMessage: '.*Apache ActiveMQ [0-9.]+ \(localhost, .*\) started.*'
+
+ # Create Camel JBang integration
+ - camel:
+ cli:
+ run:
+ waitForRunningState: false
+ integration:
+ file: "jms/jms-apache-activemq-topic-route.yaml"
+ systemProperties:
+ properties:
+ - name: "http.sink.url"
+ value: "http://localhost:${http.server.port}"
+ - name: "classic.broker.url"
+ value:
"tcp://${CITRUS_TESTCONTAINERS_ACTIVEMQ_HOST}:${CITRUS_TESTCONTAINERS_ACTIVEMQ_PORT}"
+
+ # The subscribed source gives the text, the header and the topic
+ - http:
+ server: "httpServer"
+ receiveRequest:
+ POST:
+ path: "/result"
+ type: "plaintext"
+ headers:
+ - name: "origin"
+ value: 'citrus'
+ - name: "JMSDestination"
+ value: 'topic://prices'
+ body:
+ data: 'Hello Topic'
+ - http:
+ server: "httpServer"
+ sendResponse:
+ response:
+ status: 200
+ reasonPhrase: "OK"
+ version: "HTTP/1.1"
+
diff --git
a/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-topic-route.yaml
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-topic-route.yaml
new file mode 100644
index 000000000..0da743058
--- /dev/null
+++
b/tests/camel-kamelets-itest/src/test/resources/jms/jms-apache-activemq-topic-route.yaml
@@ -0,0 +1,57 @@
+# ---------------------------------------------------------------------------
+# 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.
+# ---------------------------------------------------------------------------
+
+- route:
+ from:
+ uri: "kamelet:jms-apache-activemq-source"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationType: 'topic'
+ destinationName: 'prices'
+ username: 'amq'
+ password: 'amqpass'
+ steps:
+ # a topic hands a message only to the receivers subscribed at that
moment: the sender publishes until one arrives
+ - to:
+ uri: "controlbus:route"
+ parameters:
+ routeId: "publish"
+ action: "stop"
+ async: true
+ - to:
+ uri: "{{http.sink.url}}/result"
+
+- route:
+ id: publish
+ from:
+ uri: "timer:publish"
+ parameters:
+ period: 2000
+ steps:
+ - setBody:
+ constant: 'Hello Topic'
+ - setHeader:
+ name: origin
+ constant: 'citrus'
+ - to:
+ uri: "kamelet:jms-apache-activemq-sink"
+ parameters:
+ brokerURL: '{{classic.broker.url}}'
+ destinationType: 'topic'
+ destinationName: 'prices'
+ username: 'amq'
+ password: 'amqpass'