Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You append query options to the URI using the following format, ?option=value&option=value&...

...

SjmsComponent Options and Configurations

Below is an example of how to configure the SjmsComponent with its required ConnectionFactory provider. It will create a single connection by default and store it using the components internal pooling APIs to ensure that it is able to service Session creation requests in a thread safe manner.

Code Block

SjmsComponent component = new SjmsComponent();
component.setConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
getContext().addComponent("sjms", component);

For a SjmsComponent that is required to support a durable subscription, you can override the default ConnectionFactoryResource instance and set the clientId property.

Code Block

ConnectionFactoryResource connectionResource = new ConnectionFactoryResource();
connectionResource.setConnectionFactory(new ActiveMQConnectionFactory("tcp://localhost:61616"));
connectionResource.setClientId("myclient-id");

SjmsComponent component = new SjmsComponent();
component.setConnectionResource(connectionResource);
component.setMaxConnections(1);

Producers

InOnly Producer - (Default)

The InOnly Producer is the default behavior of the SJMS Producer Endpoint.

Code Block

from("direct:start")
    .to("sjms:queue:bar");

InOut Producer

To enable InOut behavior with the

Code Block

from("direct:start")
    .to("sjms:queue:bar?exchangePattern=InOut");

SJMS Consumer

Code Block

Transactions
Anchor
transactionCacheLevels
transactionCacheLevels

...