Camel Spring Boot

Simple JMS2

Send messages to and receive messages from a JMS queue or topic using the plain JMS 2.x API, without Spring JMS.

What’s inside

Please refer to the above links for usage and configuration details.

Maven coordinates

<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-sjms2-starter</artifactId>
</dependency>

Spring Boot Auto-Configuration

The starter supports 16 options, which are listed below.

Name Description Default Type

camel.component.sjms2.autowired-enabled

Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc.

true

Boolean

camel.component.sjms2.bridge-error-handler

Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored.

false

Boolean

camel.component.sjms2.client-id

The JMS client ID that the consumers set on their JMS connection (Connection.setClientID), for the endpoints that do not set their own. The JMS provider allows a client ID on one connection at a time, so set it on the component only when it has a single consumer endpoint. A durable topic subscription that is not shared needs it. A request/reply producer sets it, with the suffix .CamelReplyManager, on the connection of its reply consumer.

String

camel.component.sjms2.connection-factory

The JMS ConnectionFactory that creates the JMS connections; set it on the component or on the endpoint. The producer opens and closes a connection for each message it sends, so use a pooling ConnectionFactory for producers. The option is a jakarta.jms.ConnectionFactory type.

ConnectionFactory

camel.component.sjms2.deserialization-filter

Sets an ObjectInputFilter pattern (jdk.serialFilter syntax) applied as a defense-in-depth check on the class of the body returned by jakarta.jms.ObjectMessage.getObject(). The pattern is evaluated after the JMS provider has deserialized the payload, so this option alone does not prevent gadget-chain execution that happens inside the provider’s ObjectInputStream; to block such attacks, also configure the JMS provider’s own deserialization filter and/or the JVM-wide -Djdk.serialFilter. When this option is not set and no JVM-wide filter is configured, a conservative default filter denying java.net. and otherwise allowing java., javax. and org.apache.camel. is applied.

String

camel.component.sjms2.destination-creation-strategy

A custom DestinationCreationStrategy that creates the jakarta.jms.Destination for a destination name, and the temporary queue for the replies of request/reply. The default calls Session.createQueue, Session.createTopic or Session.createTemporaryQueue. The option is a org.apache.camel.component.sjms.jms.DestinationCreationStrategy type.

DestinationCreationStrategy

camel.component.sjms2.enabled

Whether to enable auto configuration of the sjms2 component. This is enabled by default.

Boolean

camel.component.sjms2.exception-listener

A jakarta.jms.ExceptionListener that the consumer (and the reply consumer of a request/reply producer) notifies when its JMS connection fails, or when a JMSException occurs while it handles a message. The consumer reconnects by itself (see recoveryInterval). The option is a jakarta.jms.ExceptionListener type.

ExceptionListener

camel.component.sjms2.header-filter-strategy

To use a custom org.apache.camel.spi.HeaderFilterStrategy to filter header to and from Camel message. The option is a org.apache.camel.spi.HeaderFilterStrategy type.

HeaderFilterStrategy

camel.component.sjms2.jms-key-format-strategy

The strategy that encodes the names of Camel headers into names that JMS allows for message properties when sending, and decodes them when receiving. The default replaces a dot with DOT and a hyphen with HYPHEN, and back. Refer to a custom org.apache.camel.component.sjms.jms.JmsKeyFormatStrategy with the # notation. The endpoints do not use the value set on the component: set it on the endpoint. The option is a org.apache.camel.component.sjms.jms.JmsKeyFormatStrategy type.

JmsKeyFormatStrategy

camel.component.sjms2.lazy-start-producer

Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing.

false

Boolean

camel.component.sjms2.message-created-strategy

A MessageCreatedStrategy that Camel calls each time it creates a jakarta.jms.Message to send (also for the replies of the consumer), to change the message before it is sent. The option is a org.apache.camel.component.sjms.jms.MessageCreatedStrategy type.

MessageCreatedStrategy

camel.component.sjms2.object-message-enabled

Whether to enable sending and receiving JMS ObjectMessage. By default this is disabled because Java object serialization is a known source of security vulnerabilities. Enable this option only if you trust the source of the messages and need to send or receive Java serialized objects via JMS. When disabled, Camel will refuse to create or read JMS ObjectMessage instances. Options that rely on ObjectMessage internally (such as transferException) require this option to be enabled.

false

Boolean

camel.component.sjms2.recovery-interval

The time in millis between the attempts of the consumer (and of the reply consumer of a request/reply producer) to reconnect after its JMS connection failed. The first attempt is made 1 second after the failure, and the attempts go on until one succeeds or the consumer stops. The option is a long type.

5000

Long

camel.component.sjms2.reply-to-on-timeout-max-concurrent-consumers

The maximum number of threads, per request/reply (InOut) producer, that continue routing the exchanges whose reply did not arrive within the requestTimeout (they continue with an ExchangeTimedOutException). Must be at least 1.

1

Integer

camel.component.sjms2.request-timeout-checker-interval

How often, in millis, a request/reply (InOut) producer checks for requests whose requestTimeout has passed, and fails them with an ExchangeTimedOutException. Lower it to react sooner to a timeout. The option is a long type.

1000

Long