JMS - Apache ActiveMQ Classic Sink
Provided by: "Apache Software Foundation"
Support Level for this Kamelet is: "Stable"
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 reached and brokerURL does not use failover:. It keeps its connections to the broker in a pool and reuses them for the next messages. It does not wait for a reply, even when the incoming message expects one, as one from webhook-source does. Headers that start with CamelJms are removed from the message first, so they cannot change what the Kamelet does.
Configuration Options
The following table summarizes the configuration options available for the jms-apache-activemq-sink Kamelet:
| Property | Name | Description | Type | Default | Example |
|---|---|---|---|---|---|
Broker URL | Required The address of the ActiveMQ Classic broker, as | string | tcp://localhost:61616 | ||
Queue or Topic Name | Required The name of the queue or topic to send the messages to. | string | orders | ||
Connection Idle Timeout | How long a connection of the pool can stay unused before it is closed, in milliseconds. For example, 30000 is 30 seconds. | integer | 30000 | ||
Persistent Delivery | 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. | boolean | |||
Queue or Topic | Whether Enum values: * queue * topic | string | queue | ||
JMS Message Type | The kind of JMS message to send, whatever the body: Enum values: * Text * Bytes | string | |||
Max Idle Sessions Per Connection | How many unused sessions each connection of the pool keeps open for reuse. Unused sessions beyond this number are closed. | integer | 500 | ||
Max Sessions Per Connection | 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. | integer | 500 | ||
Broker Password | The password to log in to the broker with, for the user | string | |||
Priority | 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. | integer | 7 | ||
Time to Live | 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 | integer | 60000 | ||
Broker Username | The user name to log in to the broker with. Leave it empty for a broker that accepts clients without a login. | string |
Dependencies
At runtime, the jms-apache-activemq-sink Kamelet relies upon the presence of the following dependencies:
-
camel:jms
-
camel:kamelet
-
mvn:org.apache.activemq:activemq-client:6.3.2
-
mvn:org.messaginghub:pooled-jms:3.2.6
Camel JBang usage
Prerequisites
-
You’ve installed JBang.
-
You have executed the following command:
jbang app install camel@apache/camel Supposing you have a file named route.yaml with this content:
- route:
from:
uri: "kamelet:timer-source"
parameters:
period: 10000
message: 'test'
steps:
- to:
uri: "kamelet:jms-apache-activemq-sink" You can now run it directly through the following command
camel run route.yaml