--- apiVersion: v1 kind: List items: - apiVersion: v1 kind: ConfigMap metadata: labels: funktion.fabric8.io/kind: Connector provider: fabric8 project: connector-jms version: 1.1.41 group: io.fabric8.funktion.connector name: jms data: deployment.yml: | --- apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: funktion.fabric8.io/kind: Subscription connector: jms spec: replicas: 1 template: metadata: labels: funktion.fabric8.io/kind: Subscription connector: jms spec: containers: - image: funktion/connector-jms:1.1.41 name: connector schema.yml: | --- component: kind: component scheme: jms syntax: jms:destinationType:destinationName title: JMS description: The jms component allows messages to be sent to (or consumed from) a JMS Queue or Topic. label: messaging deprecated: false async: true javaType: org.apache.camel.component.jms.JmsComponent groupId: org.apache.camel artifactId: camel-jms version: 2.18.1 componentProperties: configuration: kind: property type: object javaType: org.apache.camel.component.jms.JmsConfiguration deprecated: false secret: false description: To use a shared JMS configuration order: 0 acceptMessagesWhileStopping: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether the consumer accept messages while it is stopping. You may consider enabling this option if you start and stop JMS routes at runtime while there are still messages enqued on the queue. If this option is false and you stop the JMS route then messages may be rejected and the JMS broker would have to attempt redeliveries which yet again may be rejected and eventually the message may be moved at a dead letter queue on the JMS broker. To avoid this its recommended to enable this option. order: 1 allowReplyManagerQuickStop: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether the DefaultMessageListenerContainer used in the reply managers for request-reply messaging allow the DefaultMessageListenerContainer.runningAllowed flag to quick stop in case JmsConfigurationisAcceptMessagesWhileStopping is enabled and org.apache.camel.CamelContext is currently being stopped. This quick stop ability is enabled by default in the regular JMS consumers but to enable for reply managers you must enable this flag. order: 2 acknowledgementMode: kind: property type: integer javaType: int deprecated: false secret: false description: The JMS acknowledgement mode defined as an Integer. Allows you to set vendor-specific extensions to the acknowledgment mode. For the regular modes it is preferable to use the acknowledgementModeName instead. order: 3 eagerLoadingOfProperties: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Enables eager loading of JMS properties as soon as a message is loaded which generally is inefficient as the JMS properties may not be required but sometimes can catch early any issues with the underlying JMS provider and the use of JMS properties order: 4 acknowledgementModeName: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: 'The JMS acknowledgement name which is one of: SESSION_TRANSACTED CLIENT_ACKNOWLEDGE AUTO_ACKNOWLEDGE DUPS_OK_ACKNOWLEDGE' order: 5 autoStartup: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether the consumer container should auto-startup. order: 6 cacheLevel: kind: property type: integer javaType: int deprecated: false secret: false description: Sets the cache level by ID for the underlying JMS resources. See cacheLevelName option for more details. order: 7 cacheLevelName: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: 'Sets the cache level by name for the underlying JMS resources. Possible values are: CACHE_AUTO CACHE_CONNECTION CACHE_CONSUMER CACHE_NONE and CACHE_SESSION. The default setting is CACHE_AUTO. See the Spring documentation and Transactions Cache Levels for more information.' order: 8 replyToCacheLevelName: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: 'Sets the cache level by name for the reply consumer when doing request/reply over JMS. This option only applies when using fixed reply queues (not temporary). Camel will by default use: CACHE_CONSUMER for exclusive or shared w/ replyToSelectorName. And CACHE_SESSION for shared without replyToSelectorName. Some JMS brokers such as IBM WebSphere may require to set the replyToCacheLevelName=CACHE_NONE to work. Note: If using temporary queues then CACHE_NONE is not allowed and you must use a higher value such as CACHE_CONSUMER or CACHE_SESSION.' order: 9 clientId: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: Sets the JMS client ID to use. Note that this value if specified must be unique and can only be used by a single JMS connection instance. It is typically only required for durable topic subscriptions. If using Apache ActiveMQ you may prefer to use Virtual Topics instead. order: 10 concurrentConsumers: kind: property type: integer javaType: int deprecated: false secret: false description: Specifies the default number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. order: 11 replyToConcurrentConsumers: kind: property type: integer javaType: int deprecated: false secret: false description: Specifies the default number of concurrent consumers when doing request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. order: 12 connectionFactory: kind: property type: object javaType: javax.jms.ConnectionFactory deprecated: false secret: false description: Sets the default connection factory to be use order: 13 username: kind: property required: false type: string javaType: java.lang.String deprecated: false secret: true description: Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. order: 14 password: kind: property required: false type: string javaType: java.lang.String deprecated: false secret: true description: Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. order: 15 deliveryPersistent: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether persistent delivery is used by default. order: 16 deliveryMode: kind: property type: integer javaType: java.lang.Integer deprecated: false secret: false description: Specifies the delivery mode to be used. Possible values are Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT = 2. order: 17 durableSubscriptionName: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well. order: 18 exceptionListener: kind: property type: object javaType: javax.jms.ExceptionListener deprecated: false secret: false description: Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions. order: 19 errorHandler: kind: property type: object javaType: org.springframework.util.ErrorHandler deprecated: false secret: false description: Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler. order: 20 errorHandlerLoggingLevel: kind: property type: string javaType: org.apache.camel.LoggingLevel enum: - TRACE - DEBUG - INFO - WARN - ERROR - OFF deprecated: false secret: false description: Allows to configure the default errorHandler logging level for logging uncaught exceptions. order: 21 errorHandlerLogStackTrace: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Allows to control whether stacktraces should be logged or not by the default errorHandler. order: 22 explicitQosEnabled: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Set if the deliveryMode priority or timeToLive qualities of service should be used when sending messages. This option is based on Spring's JmsTemplate. The deliveryMode priority and timeToLive options are applied to the current endpoint. This contrasts with the preserveMessageQos option which operates at message granularity reading QoS properties exclusively from the Camel In message headers. order: 23 exposeListenerSession: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether the listener session should be exposed when consuming messages. order: 24 idleTaskExecutionLimit: kind: property type: integer javaType: int deprecated: false secret: false description: Specifies the limit for idle executions of a receive task not having received any message within its execution. If this limit is reached the task will shut down and leave receiving to other executing tasks (in the case of dynamic scheduling; see the maxConcurrentConsumers setting). There is additional doc available from Spring. order: 25 idleConsumerLimit: kind: property type: integer javaType: int deprecated: false secret: false description: Specify the limit for the number of consumers that are allowed to be idle at any given time. order: 26 maxConcurrentConsumers: kind: property type: integer javaType: int deprecated: false secret: false description: Specifies the maximum number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToMaxConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. order: 27 replyToMaxConcurrentConsumers: kind: property type: integer javaType: int deprecated: false secret: false description: Specifies the maximum number of concurrent consumers when using request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. order: 28 replyOnTimeoutToMaxConcurrentConsumers: kind: property type: integer javaType: int deprecated: false secret: false description: Specifies the maximum number of concurrent consumers for continue routing when timeout occurred when using request/reply over JMS. order: 29 maxMessagesPerTask: kind: property type: integer javaType: int deprecated: false secret: false description: The number of messages per task. -1 is unlimited. If you use a range for concurrent consumers (eg min max) then this option can be used to set a value to eg 100 to control how fast the consumers will shrink when less work is required. order: 30 messageConverter: kind: property type: object javaType: org.springframework.jms.support.converter.MessageConverter deprecated: false secret: false description: To use a custom Spring org.springframework.jms.support.converter.MessageConverter so you can be in control how to map to/from a javax.jms.Message. order: 31 mapJmsMessage: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether Camel should auto map the received JMS message to a suited payload type such as javax.jms.TextMessage to a String etc. See section about how mapping works below for more details. order: 32 messageIdEnabled: kind: property type: boolean javaType: boolean deprecated: false secret: false description: When sending specifies whether message IDs should be added. order: 33 messageTimestampEnabled: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether timestamps should be enabled by default on sending messages. order: 34 alwaysCopyMessage: kind: property type: boolean javaType: boolean deprecated: false secret: false description: If true Camel will always make a JMS message copy of the message when it is passed to the producer for sending. Copying the message is needed in some situations such as when a replyToDestinationSelectorName is set (incidentally Camel will set the alwaysCopyMessage option to true if a replyToDestinationSelectorName is set) order: 35 useMessageIDAsCorrelationID: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. order: 36 priority: kind: property type: integer javaType: int deprecated: false secret: false description: Values greater than 1 specify the message priority when sending (where 0 is the lowest priority and 9 is the highest). The explicitQosEnabled option must also be enabled in order for this option to have any effect. order: 37 pubSubNoLocal: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether to inhibit the delivery of messages published by its own connection. order: 38 receiveTimeout: kind: property type: integer javaType: long deprecated: false secret: false description: The timeout for receiving messages (in milliseconds). order: 39 recoveryInterval: kind: property type: integer javaType: long deprecated: false secret: false description: Specifies the interval between recovery attempts i.e. when a connection is being refreshed in milliseconds. The default is 5000 ms that is 5 seconds. order: 40 subscriptionDurable: kind: property type: boolean javaType: boolean deprecated: true secret: false description: 'Deprecated: Enabled by default if you specify a durableSubscriptionName and a clientId.' order: 41 taskExecutor: kind: property type: object javaType: org.springframework.core.task.TaskExecutor deprecated: false secret: false description: Allows you to specify a custom task executor for consuming messages. order: 42 timeToLive: kind: property type: integer javaType: long deprecated: false secret: false description: When sending messages specifies the time-to-live of the message (in milliseconds). order: 43 transacted: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether to use transacted mode order: 44 lazyCreateTransactionManager: kind: property type: boolean javaType: boolean deprecated: false secret: false description: If true Camel will create a JmsTransactionManager if there is no transactionManager injected when option transacted=true. order: 45 transactionManager: kind: property type: object javaType: org.springframework.transaction.PlatformTransactionManager deprecated: false secret: false description: The Spring transaction manager to use. order: 46 transactionName: kind: property type: string javaType: java.lang.String deprecated: false secret: false description: The name of the transaction to use. order: 47 transactionTimeout: kind: property type: integer javaType: int deprecated: false secret: false description: The timeout value of the transaction (in seconds) if using transacted mode. order: 48 testConnectionOnStartup: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Specifies whether to test the connection on startup. This ensures that when Camel starts that all the JMS consumers have a valid connection to the JMS broker. If a connection cannot be granted then Camel throws an exception on startup. This ensures that Camel is not started with failed connections. The JMS producers is tested as well. order: 49 asyncStartListener: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether to startup the JmsConsumer message listener asynchronously when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true you will let routes startup while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used then beware that if the connection could not be established then an exception is logged at WARN level and the consumer will not be able to receive messages; You can then restart the route to retry. order: 50 asyncStopListener: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether to stop the JmsConsumer message listener asynchronously when stopping a route. order: 51 forceSendOriginalMessage: kind: property type: boolean javaType: boolean deprecated: false secret: false description: When using mapJmsMessage=false Camel will create a new JMS message to send to a new JMS destination if you touch the headers (get or set) during the route. Set this option to true to force Camel to send the original JMS message that was received. order: 52 requestTimeout: kind: property type: integer javaType: long deprecated: false secret: false description: The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). The default is 20 seconds. You can include the header CamelJmsRequestTimeout to override this endpoint configured timeout value and thus have per message individual timeout values. See also the requestTimeoutCheckerInterval option. order: 53 requestTimeoutCheckerInterval: kind: property type: integer javaType: long deprecated: false secret: false description: Configures how often Camel should check for timed out Exchanges when doing request/reply over JMS. By default Camel checks once per second. But if you must react faster when a timeout occurs then you can lower this interval to check more frequently. The timeout is determined by the option requestTimeout. order: 54 transferExchange: kind: property type: boolean javaType: boolean deprecated: false secret: false description: 'You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body Out body Fault body In headers Out headers Fault headers exchange properties exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side so Camel knows the payloads is an Exchange and not a regular payload.' order: 55 transferException: kind: property type: boolean javaType: boolean deprecated: false secret: false description: If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled this option takes precedence. The caught exception is required to be serializable. The original Exception on the consumer side can be wrapped in an outer exception such as org.apache.camel.RuntimeCamelException when returned to the producer. order: 56 transferFault: kind: property type: boolean javaType: boolean deprecated: false secret: false description: If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side then the fault flag on link org.apache.camel.MessageisFault() will be send back in the response as a JMS header with the key link JmsConstantsJMS_TRANSFER_FAULT. If the client is Camel the returned fault flag will be set on the link org.apache.camel.MessagesetFault(boolean). You may want to enable this when using Camel components that support faults such as SOAP based such as cxf or spring-ws. order: 57 jmsOperations: kind: property type: object javaType: org.springframework.jms.core.JmsOperations deprecated: false secret: false description: Allows you to use your own implementation of the org.springframework.jms.core.JmsOperations interface. Camel uses JmsTemplate as default. Can be used for testing purpose but not used much as stated in the spring API docs. order: 58 destinationResolver: kind: property type: object javaType: org.springframework.jms.support.destination.DestinationResolver deprecated: false secret: false description: A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example to lookup the real destination in a JNDI registry). order: 59 replyToType: kind: property type: string javaType: org.apache.camel.component.jms.ReplyToType enum: - Temporary - Shared - Exclusive deprecated: false secret: false description: 'Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary Shared or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See Camel JMS documentation for more details and especially the notes about the implications if running in a clustered environment and the fact that Shared reply queues has lower performance than its alternatives Temporary and Exclusive.' order: 60 preserveMessageQos: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Set to true if you want to send message using the QoS settings specified on the message instead of the QoS settings on the JMS endpoint. The following three headers are considered JMSPriority JMSDeliveryMode and JMSExpiration. You can provide all or only some of them. If not provided Camel will fall back to use the values from the endpoint instead. So when using this option the headers override the values from the endpoint. The explicitQosEnabled option by contrast will only use options set on the endpoint and not values from the message header. order: 61 asyncConsumer: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether the JmsConsumer processes the Exchange asynchronously. If enabled then the JmsConsumer may pickup the next message from the JMS queue while the previous message is being processed asynchronously (by the Asynchronous Routing Engine). This means that messages may be processed not 100 strictly in order. If disabled (as default) then the Exchange is fully processed before the JmsConsumer will pickup the next message from the JMS queue. Note if transacted has been enabled then asyncConsumer=true does not run asynchronously as transaction must be executed synchronously (Camel 3.0 may support async transactions). order: 62 allowNullBody: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Whether to allow sending messages with no body. If this option is false and the message body is null then an JMSException is thrown. order: 63 includeSentJMSMessageID: kind: property type: boolean javaType: boolean deprecated: false secret: false description: Only applicable when sending to JMS destination using InOnly (eg fire and forget). Enabling this option will enrich the Camel Exchange with the actual JMSMessageID that was used by the JMS client when the message was sent to the JMS destination. order: 64 includeAllJMSXProperties: kind: property type: boolean javaType: boolean deprecated: false secret: false description: 'Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply.' order: 65 defaultTaskExecutorType: kind: property type: string javaType: org.apache.camel.component.jms.DefaultTaskExecutorType enum: - ThreadPool - SimpleAsync deprecated: false secret: false description: 'Specifies what default TaskExecutor type to use in the DefaultMessageListenerContainer for both consumer endpoints and the ReplyTo consumer of producer endpoints. Possible values: SimpleAsync (uses Spring''s SimpleAsyncTaskExecutor) or ThreadPool (uses Spring''s ThreadPoolTaskExecutor with optimal values - cached threadpool-like). If not set it defaults to the previous behaviour which uses a cached thread pool for consumer endpoints and SimpleAsync for reply consumers. The use of ThreadPool is recommended to reduce thread trash in elastic configurations with dynamically increasing and decreasing concurrent consumers.' order: 66 jmsKeyFormatStrategy: kind: property type: object javaType: org.apache.camel.component.jms.JmsKeyFormatStrategy deprecated: false secret: false description: 'Pluggable strategy for encoding and decoding JMS keys so they can be compliant with the JMS specification. Camel provides two implementations out of the box: default and passthrough. The default strategy will safely marshal dots and hyphens (. and -). The passthrough strategy leaves the key as is. Can be used for JMS brokers which do not care whether JMS header keys contain illegal characters. You can provide your own implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the notation.' order: 67 applicationContext: kind: property type: object javaType: org.springframework.context.ApplicationContext deprecated: false secret: false description: Sets the Spring ApplicationContext to use order: 68 queueBrowseStrategy: kind: property type: object javaType: org.apache.camel.component.jms.QueueBrowseStrategy deprecated: false secret: false description: To use a custom QueueBrowseStrategy when browsing queues order: 69 headerFilterStrategy: kind: property type: object javaType: org.apache.camel.spi.HeaderFilterStrategy deprecated: false secret: false description: To use a custom HeaderFilterStrategy to filter header to and from Camel message. order: 70 messageCreatedStrategy: kind: property type: object javaType: org.apache.camel.component.jms.MessageCreatedStrategy deprecated: false secret: false description: To use the given MessageCreatedStrategy which are invoked when Camel creates new instances of javax.jms.Message objects when Camel is sending a JMS message. order: 71 waitForProvisionCorrelationToBeUpdatedCounter: kind: property type: integer javaType: int deprecated: false secret: false description: Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. order: 72 waitForProvisionCorrelationToBeUpdatedThreadSleepingTime: kind: property type: integer javaType: long deprecated: false secret: false description: Interval in millis to sleep each time while waiting for provisional correlation id to be updated. order: 73 properties: destinationType: kind: path group: common type: string javaType: java.lang.String enum: - queue - topic - temp:queue - temp:topic deprecated: false secret: false defaultValue: queue description: The kind of destination to use order: 0 destinationName: kind: path group: common required: true type: string javaType: java.lang.String deprecated: false secret: false description: Name of the queue or topic to use as destination order: 1 clientId: kind: parameter group: common type: string javaType: java.lang.String deprecated: false secret: false description: Sets the JMS client ID to use. Note that this value if specified must be unique and can only be used by a single JMS connection instance. It is typically only required for durable topic subscriptions. If using Apache ActiveMQ you may prefer to use Virtual Topics instead. order: 2 connectionFactory: kind: parameter group: common type: object javaType: javax.jms.ConnectionFactory deprecated: false secret: false description: Sets the default connection factory to be used if a connection factory is not specified for either link setTemplateConnectionFactory(ConnectionFactory) or link setListenerConnectionFactory(ConnectionFactory) order: 3 disableReplyTo: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If true a producer will behave like a InOnly exchange with the exception that JMSReplyTo header is sent out and not be suppressed like in the case of InOnly. Like InOnly the producer will not wait for a reply. A consumer with this flag will behave like InOnly. This feature can be used to bridge InOut requests to another queue so that a route on the other queue will send its response directly back to the original JMSReplyTo. order: 4 durableSubscriptionName: kind: parameter group: common type: string javaType: java.lang.String deprecated: false secret: false description: The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well. order: 5 jmsMessageType: kind: parameter group: common type: string javaType: org.apache.camel.component.jms.JmsMessageType enum: - Bytes - Map - Object - Stream - Text deprecated: false secret: false description: 'Allows you to force the use of a specific javax.jms.Message implementation for sending JMS messages. Possible values are: Bytes Map Object Stream Text. By default Camel would determine which JMS message type to use from the In body type. This option allows you to specify it.' order: 6 testConnectionOnStartup: kind: parameter group: common type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Specifies whether to test the connection on startup. This ensures that when Camel starts that all the JMS consumers have a valid connection to the JMS broker. If a connection cannot be granted then Camel throws an exception on startup. This ensures that Camel is not started with failed connections. The JMS producers is tested as well. order: 7 acknowledgementModeName: kind: parameter group: consumer label: consumer type: string javaType: java.lang.String enum: - SESSION_TRANSACTED - CLIENT_ACKNOWLEDGE - AUTO_ACKNOWLEDGE - DUPS_OK_ACKNOWLEDGE deprecated: false secret: false defaultValue: AUTO_ACKNOWLEDGE description: 'The JMS acknowledgement name which is one of: SESSION_TRANSACTED CLIENT_ACKNOWLEDGE AUTO_ACKNOWLEDGE DUPS_OK_ACKNOWLEDGE' order: 8 asyncConsumer: kind: parameter group: consumer label: consumer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether the JmsConsumer processes the Exchange asynchronously. If enabled then the JmsConsumer may pickup the next message from the JMS queue while the previous message is being processed asynchronously (by the Asynchronous Routing Engine). This means that messages may be processed not 100 strictly in order. If disabled (as default) then the Exchange is fully processed before the JmsConsumer will pickup the next message from the JMS queue. Note if transacted has been enabled then asyncConsumer=true does not run asynchronously as transaction must be executed synchronously (Camel 3.0 may support async transactions). order: 9 autoStartup: kind: parameter group: consumer label: consumer type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Specifies whether the consumer container should auto-startup. order: 10 bridgeErrorHandler: kind: parameter group: consumer label: consumer type: boolean javaType: boolean optionalPrefix: consumer. deprecated: false secret: false defaultValue: false description: Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored. order: 11 cacheLevelName: kind: parameter group: consumer label: consumer type: string javaType: java.lang.String enum: - CACHE_AUTO - CACHE_CONNECTION - CACHE_CONSUMER - CACHE_NONE - CACHE_SESSION deprecated: false secret: false defaultValue: CACHE_AUTO description: 'Sets the cache level by name for the underlying JMS resources. Possible values are: CACHE_AUTO CACHE_CONNECTION CACHE_CONSUMER CACHE_NONE and CACHE_SESSION. The default setting is CACHE_AUTO. See the Spring documentation and Transactions Cache Levels for more information.' order: 12 concurrentConsumers: kind: parameter group: consumer label: consumer type: integer javaType: int deprecated: false secret: false defaultValue: "1" description: Specifies the default number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. order: 13 maxConcurrentConsumers: kind: parameter group: consumer label: consumer type: integer javaType: int deprecated: false secret: false description: Specifies the maximum number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToMaxConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. order: 14 replyTo: kind: parameter group: consumer label: consumer type: string javaType: java.lang.String deprecated: false secret: false description: Provides an explicit ReplyTo destination which overrides any incoming value of Message.getJMSReplyTo(). order: 15 replyToDeliveryPersistent: kind: parameter group: consumer label: consumer type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Specifies whether to use persistent delivery by default for replies. order: 16 selector: kind: parameter group: consumer label: consumer type: string javaType: java.lang.String deprecated: false secret: false description: Sets the JMS selector to use order: 17 acceptMessagesWhileStopping: kind: parameter group: consumer (advanced) label: consumer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Specifies whether the consumer accept messages while it is stopping. You may consider enabling this option if you start and stop JMS routes at runtime while there are still messages enqued on the queue. If this option is false and you stop the JMS route then messages may be rejected and the JMS broker would have to attempt redeliveries which yet again may be rejected and eventually the message may be moved at a dead letter queue on the JMS broker. To avoid this its recommended to enable this option. order: 18 allowReplyManagerQuickStop: kind: parameter group: consumer (advanced) label: consumer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether the DefaultMessageListenerContainer used in the reply managers for request-reply messaging allow the DefaultMessageListenerContainer.runningAllowed flag to quick stop in case link JmsConfigurationisAcceptMessagesWhileStopping() is enabled and org.apache.camel.CamelContext is currently being stopped. This quick stop ability is enabled by default in the regular JMS consumers but to enable for reply managers you must enable this flag. order: 19 consumerType: kind: parameter group: consumer (advanced) label: consumer,advanced type: string javaType: org.apache.camel.component.jms.ConsumerType enum: - Simple - Default - Custom deprecated: false secret: false defaultValue: Default description: 'The consumer type to use which can be one of: Simple Default or Custom. The consumer type determines which Spring JMS listener to use. Default will use org.springframework.jms.listener.DefaultMessageListenerContainer Simple will use org.springframework.jms.listener.SimpleMessageListenerContainer. When Custom is specified the MessageListenerContainerFactory defined by the messageListenerContainerFactory option will determine what org.springframework.jms.listener.AbstractMessageListenerContainer to use.' order: 20 defaultTaskExecutorType: kind: parameter group: consumer (advanced) label: consumer,advanced type: string javaType: org.apache.camel.component.jms.DefaultTaskExecutorType enum: - ThreadPool - SimpleAsync deprecated: false secret: false description: 'Specifies what default TaskExecutor type to use in the DefaultMessageListenerContainer for both consumer endpoints and the ReplyTo consumer of producer endpoints. Possible values: SimpleAsync (uses Spring''s SimpleAsyncTaskExecutor) or ThreadPool (uses Spring''s ThreadPoolTaskExecutor with optimal values - cached threadpool-like). If not set it defaults to the previous behaviour which uses a cached thread pool for consumer endpoints and SimpleAsync for reply consumers. The use of ThreadPool is recommended to reduce thread trash in elastic configurations with dynamically increasing and decreasing concurrent consumers.' order: 21 eagerLoadingOfProperties: kind: parameter group: consumer (advanced) label: consumer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Enables eager loading of JMS properties as soon as a message is loaded which generally is inefficient as the JMS properties may not be required but sometimes can catch early any issues with the underlying JMS provider and the use of JMS properties order: 22 exceptionHandler: kind: parameter group: consumer (advanced) label: consumer,advanced type: object javaType: org.apache.camel.spi.ExceptionHandler optionalPrefix: consumer. deprecated: false secret: false description: To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored. order: 23 exchangePattern: kind: parameter group: consumer (advanced) label: consumer,advanced type: string javaType: org.apache.camel.ExchangePattern enum: - InOnly - RobustInOnly - InOut - InOptionalOut - OutOnly - RobustOutOnly - OutIn - OutOptionalIn deprecated: false secret: false description: Sets the exchange pattern when the consumer creates an exchange. order: 24 exposeListenerSession: kind: parameter group: consumer (advanced) label: consumer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Specifies whether the listener session should be exposed when consuming messages. order: 25 replyToSameDestinationAllowed: kind: parameter group: consumer (advanced) label: consumer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether a JMS consumer is allowed to send a reply message to the same destination that the consumer is using to consume from. This prevents an endless loop by consuming and sending back the same message to itself. order: 26 deliveryMode: kind: parameter group: producer label: producer type: string javaType: java.lang.Integer enum: - "1" - "2" deprecated: false secret: false description: Specifies the delivery mode to be used. Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT = 2. order: 27 deliveryPersistent: kind: parameter group: producer label: producer type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Specifies whether persistent delivery is used by default. order: 28 explicitQosEnabled: kind: parameter group: producer label: producer type: boolean javaType: java.lang.Boolean deprecated: false secret: false defaultValue: false description: Set if the deliveryMode priority or timeToLive qualities of service should be used when sending messages. This option is based on Spring's JmsTemplate. The deliveryMode priority and timeToLive options are applied to the current endpoint. This contrasts with the preserveMessageQos option which operates at message granularity reading QoS properties exclusively from the Camel In message headers. order: 29 preserveMessageQos: kind: parameter group: producer label: producer type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Set to true if you want to send message using the QoS settings specified on the message instead of the QoS settings on the JMS endpoint. The following three headers are considered JMSPriority JMSDeliveryMode and JMSExpiration. You can provide all or only some of them. If not provided Camel will fall back to use the values from the endpoint instead. So when using this option the headers override the values from the endpoint. The explicitQosEnabled option by contrast will only use options set on the endpoint and not values from the message header. order: 30 priority: kind: parameter group: producer label: producer type: string javaType: int enum: - "1" - "2" - "3" - "4" - "5" - "6" - "7" - "8" - "9" deprecated: false secret: false defaultValue: "4" description: Values greater than 1 specify the message priority when sending (where 0 is the lowest priority and 9 is the highest). The explicitQosEnabled option must also be enabled in order for this option to have any effect. order: 31 replyToConcurrentConsumers: kind: parameter group: producer label: producer type: integer javaType: int deprecated: false secret: false defaultValue: "1" description: Specifies the default number of concurrent consumers when doing request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. order: 32 replyToMaxConcurrentConsumers: kind: parameter group: producer label: producer type: integer javaType: int deprecated: false secret: false description: Specifies the maximum number of concurrent consumers when using request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. order: 33 replyToOnTimeoutMaxConcurrentConsumers: kind: parameter group: producer label: producer type: integer javaType: int deprecated: false secret: false defaultValue: "1" description: Specifies the maximum number of concurrent consumers for continue routing when timeout occurred when using request/reply over JMS. order: 34 replyToOverride: kind: parameter group: producer label: producer type: string javaType: java.lang.String deprecated: false secret: false description: Provides an explicit ReplyTo destination in the JMS message which overrides the setting of replyTo. It is useful if you want to forward the message to a remote Queue and receive the reply message from the ReplyTo destination. order: 35 replyToType: kind: parameter group: producer label: producer type: string javaType: org.apache.camel.component.jms.ReplyToType enum: - Temporary - Shared - Exclusive deprecated: false secret: false description: 'Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary Shared or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See Camel JMS documentation for more details and especially the notes about the implications if running in a clustered environment and the fact that Shared reply queues has lower performance than its alternatives Temporary and Exclusive.' order: 36 requestTimeout: kind: parameter group: producer label: producer type: integer javaType: long deprecated: false secret: false defaultValue: "20000" description: The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). The default is 20 seconds. You can include the header CamelJmsRequestTimeout to override this endpoint configured timeout value and thus have per message individual timeout values. See also the requestTimeoutCheckerInterval option. order: 37 timeToLive: kind: parameter group: producer label: producer type: integer javaType: long deprecated: false secret: false defaultValue: -1 description: When sending messages specifies the time-to-live of the message (in milliseconds). order: 38 allowNullBody: kind: parameter group: producer (advanced) label: producer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Whether to allow sending messages with no body. If this option is false and the message body is null then an JMSException is thrown. order: 39 alwaysCopyMessage: kind: parameter group: producer (advanced) label: producer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If true Camel will always make a JMS message copy of the message when it is passed to the producer for sending. Copying the message is needed in some situations such as when a replyToDestinationSelectorName is set (incidentally Camel will set the alwaysCopyMessage option to true if a replyToDestinationSelectorName is set) order: 40 disableTimeToLive: kind: parameter group: producer (advanced) label: producer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Use this option to force disabling time to live. For example when you do request/reply over JMS then Camel will by default use the requestTimeout value as time to live on the message being sent. The problem is that the sender and receiver systems have to have their clocks synchronized so they are in sync. This is not always so easy to archive. So you can use disableTimeToLive=true to not set a time to live value on the sent message. Then the message will not expire on the receiver system. See below in section About time to live for more details. order: 41 forceSendOriginalMessage: kind: parameter group: producer (advanced) label: producer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: When using mapJmsMessage=false Camel will create a new JMS message to send to a new JMS destination if you touch the headers (get or set) during the route. Set this option to true to force Camel to send the original JMS message that was received. order: 42 includeSentJMSMessageID: kind: parameter group: producer (advanced) label: producer,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Only applicable when sending to JMS destination using InOnly (eg fire and forget). Enabling this option will enrich the Camel Exchange with the actual JMSMessageID that was used by the JMS client when the message was sent to the JMS destination. order: 43 replyToCacheLevelName: kind: parameter group: producer (advanced) label: producer,advanced type: string javaType: java.lang.String deprecated: false secret: false description: 'Sets the cache level by name for the reply consumer when doing request/reply over JMS. This option only applies when using fixed reply queues (not temporary). Camel will by default use: CACHE_CONSUMER for exclusive or shared w/ replyToSelectorName. And CACHE_SESSION for shared without replyToSelectorName. Some JMS brokers such as IBM WebSphere may require to set the replyToCacheLevelName=CACHE_NONE to work. Note: If using temporary queues then CACHE_NONE is not allowed and you must use a higher value such as CACHE_CONSUMER or CACHE_SESSION.' order: 44 replyToDestinationSelectorName: kind: parameter group: producer (advanced) label: producer,advanced type: string javaType: java.lang.String deprecated: false secret: false description: Sets the JMS Selector using the fixed name to be used so you can filter out your own replies from the others when using a shared queue (that is if you are not using a temporary reply queue). order: 45 asyncStartListener: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether to startup the JmsConsumer message listener asynchronously when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true you will let routes startup while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used then beware that if the connection could not be established then an exception is logged at WARN level and the consumer will not be able to receive messages; You can then restart the route to retry. order: 46 asyncStopListener: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Whether to stop the JmsConsumer message listener asynchronously when stopping a route. order: 47 destinationResolver: kind: parameter group: advanced label: advanced type: object javaType: org.springframework.jms.support.destination.DestinationResolver deprecated: false secret: false description: A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example to lookup the real destination in a JNDI registry). order: 48 errorHandler: kind: parameter group: advanced label: advanced type: object javaType: org.springframework.util.ErrorHandler deprecated: false secret: false description: Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler. order: 49 errorHandlerLoggingLevel: kind: parameter group: advanced label: advanced type: string javaType: org.apache.camel.LoggingLevel enum: - TRACE - DEBUG - INFO - WARN - ERROR - OFF deprecated: false secret: false defaultValue: WARN description: Allows to configure the default errorHandler logging level for logging uncaught exceptions. order: 50 errorHandlerLogStackTrace: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Allows to control whether stacktraces should be logged or not by the default errorHandler. order: 51 exceptionListener: kind: parameter group: advanced label: advanced type: object javaType: javax.jms.ExceptionListener deprecated: false secret: false description: Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions. order: 52 headerFilterStrategy: kind: parameter group: advanced label: advanced type: object javaType: org.apache.camel.spi.HeaderFilterStrategy deprecated: false secret: false description: To use a custom HeaderFilterStrategy to filter header to and from Camel message. order: 53 idleConsumerLimit: kind: parameter group: advanced label: advanced type: integer javaType: int deprecated: false secret: false defaultValue: "1" description: Specify the limit for the number of consumers that are allowed to be idle at any given time. order: 54 idleTaskExecutionLimit: kind: parameter group: advanced label: advanced type: integer javaType: int deprecated: false secret: false defaultValue: "1" description: Specifies the limit for idle executions of a receive task not having received any message within its execution. If this limit is reached the task will shut down and leave receiving to other executing tasks (in the case of dynamic scheduling; see the maxConcurrentConsumers setting). There is additional doc available from Spring. order: 55 includeAllJMSXProperties: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: 'Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply.' order: 56 jmsKeyFormatStrategy: kind: parameter group: advanced label: advanced type: string javaType: java.lang.String enum: - default - passthrough deprecated: false secret: false description: 'Pluggable strategy for encoding and decoding JMS keys so they can be compliant with the JMS specification. Camel provides two implementations out of the box: default and passthrough. The default strategy will safely marshal dots and hyphens (. and -). The passthrough strategy leaves the key as is. Can be used for JMS brokers which do not care whether JMS header keys contain illegal characters. You can provide your own implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the notation.' order: 57 mapJmsMessage: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Specifies whether Camel should auto map the received JMS message to a suited payload type such as javax.jms.TextMessage to a String etc. order: 58 maxMessagesPerTask: kind: parameter group: advanced label: advanced type: integer javaType: int deprecated: false secret: false defaultValue: -1 description: The number of messages per task. -1 is unlimited. If you use a range for concurrent consumers (eg min max) then this option can be used to set a value to eg 100 to control how fast the consumers will shrink when less work is required. order: 59 messageConverter: kind: parameter group: advanced label: advanced type: object javaType: org.springframework.jms.support.converter.MessageConverter deprecated: false secret: false description: To use a custom Spring org.springframework.jms.support.converter.MessageConverter so you can be in control how to map to/from a javax.jms.Message. order: 60 messageCreatedStrategy: kind: parameter group: advanced label: advanced type: object javaType: org.apache.camel.component.jms.MessageCreatedStrategy deprecated: false secret: false description: To use the given MessageCreatedStrategy which are invoked when Camel creates new instances of javax.jms.Message objects when Camel is sending a JMS message. order: 61 messageIdEnabled: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: When sending specifies whether message IDs should be added. This is just an hint to the JMS Broker. If the JMS provider accepts this hint these messages must have the message ID set to null; if the provider ignores the hint the message ID must be set to its normal unique value order: 62 messageListenerContainerFactory: kind: parameter group: advanced label: advanced type: object javaType: org.apache.camel.component.jms.MessageListenerContainerFactory deprecated: false secret: false description: Registry ID of the MessageListenerContainerFactory used to determine what org.springframework.jms.listener.AbstractMessageListenerContainer to use to consume messages. Setting this will automatically set consumerType to Custom. order: 63 messageTimestampEnabled: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: Specifies whether timestamps should be enabled by default on sending messages. This is just an hint to the JMS Broker. If the JMS provider accepts this hint these messages must have the timestamp set to zero; if the provider ignores the hint the timestamp must be set to its normal value order: 64 pubSubNoLocal: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Specifies whether to inhibit the delivery of messages published by its own connection. order: 65 receiveTimeout: kind: parameter group: advanced label: advanced type: integer javaType: long deprecated: false secret: false defaultValue: "1000" description: The timeout for receiving messages (in milliseconds). order: 66 recoveryInterval: kind: parameter group: advanced label: advanced type: integer javaType: long deprecated: false secret: false defaultValue: "5000" description: Specifies the interval between recovery attempts i.e. when a connection is being refreshed in milliseconds. The default is 5000 ms that is 5 seconds. order: 67 requestTimeoutCheckerInterval: kind: parameter group: advanced label: advanced type: integer javaType: long deprecated: false secret: false defaultValue: "1000" description: Configures how often Camel should check for timed out Exchanges when doing request/reply over JMS. By default Camel checks once per second. But if you must react faster when a timeout occurs then you can lower this interval to check more frequently. The timeout is determined by the option requestTimeout. order: 68 synchronous: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). order: 69 transferException: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled this option takes precedence. The caught exception is required to be serializable. The original Exception on the consumer side can be wrapped in an outer exception such as org.apache.camel.RuntimeCamelException when returned to the producer. order: 70 transferExchange: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: 'You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body Out body Fault body In headers Out headers Fault headers exchange properties exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side so Camel knows the payloads is an Exchange and not a regular payload.' order: 71 transferFault: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side then the fault flag on link org.apache.camel.MessageisFault() will be send back in the response as a JMS header with the key link JmsConstantsJMS_TRANSFER_FAULT. If the client is Camel the returned fault flag will be set on the link org.apache.camel.MessagesetFault(boolean). You may want to enable this when using Camel components that support faults such as SOAP based such as cxf or spring-ws. order: 72 useMessageIDAsCorrelationID: kind: parameter group: advanced label: advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. order: 73 waitForProvisionCorrelationToBeUpdatedCounter: kind: parameter group: advanced label: advanced type: integer javaType: int deprecated: false secret: false defaultValue: "50" description: Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. order: 74 waitForProvisionCorrelationToBeUpdatedThreadSleepingTime: kind: parameter group: advanced label: advanced type: integer javaType: long deprecated: false secret: false defaultValue: "100" description: Interval in millis to sleep each time while waiting for provisional correlation id to be updated. order: 75 password: kind: parameter group: security label: security type: string javaType: java.lang.String deprecated: false secret: true description: Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. order: 76 username: kind: parameter group: security label: security type: string javaType: java.lang.String deprecated: false secret: true description: Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. order: 77 transacted: kind: parameter group: transaction label: transaction type: boolean javaType: boolean deprecated: false secret: false defaultValue: false description: Specifies whether to use transacted mode order: 78 lazyCreateTransactionManager: kind: parameter group: transaction (advanced) label: transaction,advanced type: boolean javaType: boolean deprecated: false secret: false defaultValue: true description: If true Camel will create a JmsTransactionManager if there is no transactionManager injected when option transacted=true. order: 79 transactionManager: kind: parameter group: transaction (advanced) label: transaction,advanced type: object javaType: org.springframework.transaction.PlatformTransactionManager deprecated: false secret: false description: The Spring transaction manager to use. order: 80 transactionName: kind: parameter group: transaction (advanced) label: transaction,advanced type: string javaType: java.lang.String deprecated: false secret: false description: The name of the transaction to use. order: 81 transactionTimeout: kind: parameter group: transaction (advanced) label: transaction,advanced type: integer javaType: int deprecated: false secret: false defaultValue: -1 description: The timeout value of the transaction (in seconds) if using transacted mode. order: 82 documentation.adoc: | ifdef::env-github[] :icon-smile: :smiley: :caution-caption: :boom: :important-caption: :exclamation: :note-caption: :information_source: :tip-caption: :bulb: :warning-caption: :warning: endif::[] ifndef::env-github[] :icons: font :icon-smile: icon:smile-o[fw,role=yellow] endif::[] [[JMS-JMSComponent]] JMS Component ~~~~~~~~~~~~~ [TIP] ==== *Using ActiveMQ* If you are using http://activemq.apache.org/[Apache ActiveMQ], you should prefer the link:activemq.html[ActiveMQ] component as it has been optimized for link:activemq.html[ActiveMQ]. All of the options and samples on this page are also valid for the link:activemq.html[ActiveMQ] component. ==== [NOTE] ==== *Transacted and caching* See section _Transactions and Cache Levels_ below if you are using transactions with link:jms.html[JMS] as it can impact performance. ==== [NOTE] ==== *Request/Reply over JMS* Make sure to read the section _Request-reply over JMS_ further below on this page for important notes about request/reply, as Camel offers a number of options to configure for performance, and clustered environments. ==== This??component allows messages to be sent to (or consumed from) a http://java.sun.com/products/jms/[JMS] Queue or Topic. It uses Spring's JMS support for declarative transactions, including Spring's `JmsTemplate` for sending and a `MessageListenerContainer` for consuming. Maven users will need to add the following dependency to their `pom.xml` for this component: [source,xml] ------------------------------------------------------------ org.apache.camel camel-jms x.x.x ------------------------------------------------------------ [[JMS-URIformat]] URI format ^^^^^^^^^^ -------------------------------------------- jms:[queue:|topic:]destinationName[?options] -------------------------------------------- Where `destinationName` is a JMS queue or topic name. By default, the `destinationName` is interpreted as a queue name. For example, to connect to the queue, `FOO.BAR` use: ----------- jms:FOO.BAR ----------- You can include the optional `queue:` prefix, if you prefer: ----------------- jms:queue:FOO.BAR ----------------- To connect to a topic, you _must_ include the `topic:` prefix. For example, to + connect to the topic, `Stocks.Prices`, use: ----------------------- jms:topic:Stocks.Prices ----------------------- You append query options to the URI using the following format, `?option=value&option=value&...` [[JMS-Notes]] Notes ^^^^^ [[JMS-UsingActiveMQ]] Using ActiveMQ ++++++++++++++ The JMS component reuses Spring 2's `JmsTemplate` for sending messages. This is not ideal for use in a non-J2EE container and typically requires some caching in the JMS provider to avoid http://activemq.apache.org/jmstemplate-gotchas.html[poor performance]. If you intend to use http://activemq.apache.org/[Apache ActiveMQ] as your Message Broker - which is a good choice as ActiveMQ rocks {icon-smile}, then we recommend that you either: * Use the link:activemq.html[ActiveMQ] component, which is already optimized to use ActiveMQ efficiently * Use the `PoolingConnectionFactory` in ActiveMQ. [[JMS-TransactionsandCacheLevels]] Transactions and Cache Levels +++++++++++++++++++++++++++++ If you are consuming messages and using transactions (`transacted=true`) then the default settings for cache level can impact performance. If you are using XA transactions then you cannot cache as it can cause the XA transaction to not work properly. If you are *not* using XA, then you should consider caching as it speeds up performance, such as setting `cacheLevelName=CACHE_CONSUMER`. Through Camel 2.7.x, the default setting for `cacheLevelName` is `CACHE_CONSUMER`. You will need to explicitly set `cacheLevelName=CACHE_NONE`. In Camel 2.8 onwards, the default setting for `cacheLevelName` is `CACHE_AUTO`. This default auto detects the mode and sets the cache level accordingly to: * `CACHE_CONSUMER` if `transacted=false` * `CACHE_NONE` if `transacted=true` So you can say the default setting is conservative. Consider using `cacheLevelName=CACHE_CONSUMER` if you are using non-XA transactions. [[JMS-DurableSubscriptions]] Durable Subscriptions +++++++++++++++++++++ If you wish to use durable topic subscriptions, you need to specify both `clientId` and `durableSubscriptionName`. The value of the `clientId` must be unique and can only be used by a single JMS connection instance in your entire network. You may prefer to use http://activemq.apache.org/virtual-destinations.html[Virtual Topics] instead to avoid this limitation. More background on durable messaging http://activemq.apache.org/how-do-durable-queues-and-topics-work.html[here]. [[JMS-MessageHeaderMapping]] Message Header Mapping ++++++++++++++++++++++ When using message headers, the JMS specification states that header names must be valid Java identifiers. So try to name your headers to be valid Java identifiers. One benefit of doing this is that you can then use your headers inside a JMS Selector (whose SQL92 syntax mandates Java identifier syntax for headers). A simple strategy for mapping header names is used by default. The strategy is to replace any dots and hyphens in the header name as shown below and to reverse the replacement when the header name is restored from a JMS message sent over the wire. What does this mean? No more losing method names to invoke on a bean component, no more losing the filename header for the File Component, and so on. The current header name strategy for accepting header names in Camel is as follows: * Dots are replaced by `_DOT_` and the replacement is reversed when Camel consume the message * Hyphen is replaced by `_HYPHEN_` and the replacement is reversed when Camel consumes the message [[JMS-Options]] Options ^^^^^^^ You can configure many different properties on the JMS endpoint which map to properties on the http://camel.apache.org/maven/current/camel-jms/apidocs/org/apache/camel/component/jms/JmsConfiguration.html[JMSConfiguration POJO]. [WARNING] ==== *Mapping to Spring JMS* Many of these properties map to properties on Spring JMS, which Camel uses for sending and receiving messages. So you can get more information about these properties by consulting the relevant Spring documentation. ==== [[JMS-Componentoptions]] Component options +++++++++++++++++ // component options: START The JMS component supports 74 options which are listed below. {% raw %} [width="100%",cols="2,1m,7",options="header"] |======================================================================= | Name | Java Type | Description | configuration | JmsConfiguration | To use a shared JMS configuration | acceptMessagesWhileStopping | boolean | Specifies whether the consumer accept messages while it is stopping. You may consider enabling this option if you start and stop JMS routes at runtime while there are still messages enqued on the queue. If this option is false and you stop the JMS route then messages may be rejected and the JMS broker would have to attempt redeliveries which yet again may be rejected and eventually the message may be moved at a dead letter queue on the JMS broker. To avoid this its recommended to enable this option. | allowReplyManagerQuickStop | boolean | Whether the DefaultMessageListenerContainer used in the reply managers for request-reply messaging allow the DefaultMessageListenerContainer.runningAllowed flag to quick stop in case JmsConfigurationisAcceptMessagesWhileStopping is enabled and org.apache.camel.CamelContext is currently being stopped. This quick stop ability is enabled by default in the regular JMS consumers but to enable for reply managers you must enable this flag. | acknowledgementMode | int | The JMS acknowledgement mode defined as an Integer. Allows you to set vendor-specific extensions to the acknowledgment mode. For the regular modes it is preferable to use the acknowledgementModeName instead. | eagerLoadingOfProperties | boolean | Enables eager loading of JMS properties as soon as a message is loaded which generally is inefficient as the JMS properties may not be required but sometimes can catch early any issues with the underlying JMS provider and the use of JMS properties | acknowledgementModeName | String | The JMS acknowledgement name which is one of: SESSION_TRANSACTED CLIENT_ACKNOWLEDGE AUTO_ACKNOWLEDGE DUPS_OK_ACKNOWLEDGE | autoStartup | boolean | Specifies whether the consumer container should auto-startup. | cacheLevel | int | Sets the cache level by ID for the underlying JMS resources. See cacheLevelName option for more details. | cacheLevelName | String | Sets the cache level by name for the underlying JMS resources. Possible values are: CACHE_AUTO CACHE_CONNECTION CACHE_CONSUMER CACHE_NONE and CACHE_SESSION. The default setting is CACHE_AUTO. See the Spring documentation and Transactions Cache Levels for more information. | replyToCacheLevelName | String | Sets the cache level by name for the reply consumer when doing request/reply over JMS. This option only applies when using fixed reply queues (not temporary). Camel will by default use: CACHE_CONSUMER for exclusive or shared w/ replyToSelectorName. And CACHE_SESSION for shared without replyToSelectorName. Some JMS brokers such as IBM WebSphere may require to set the replyToCacheLevelName=CACHE_NONE to work. Note: If using temporary queues then CACHE_NONE is not allowed and you must use a higher value such as CACHE_CONSUMER or CACHE_SESSION. | clientId | String | Sets the JMS client ID to use. Note that this value if specified must be unique and can only be used by a single JMS connection instance. It is typically only required for durable topic subscriptions. If using Apache ActiveMQ you may prefer to use Virtual Topics instead. | concurrentConsumers | int | Specifies the default number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. | replyToConcurrentConsumers | int | Specifies the default number of concurrent consumers when doing request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. | connectionFactory | ConnectionFactory | Sets the default connection factory to be use | username | String | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | password | String | Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | deliveryPersistent | boolean | Specifies whether persistent delivery is used by default. | deliveryMode | Integer | Specifies the delivery mode to be used. Possible values are Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT = 2. | durableSubscriptionName | String | The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well. | exceptionListener | ExceptionListener | Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions. | errorHandler | ErrorHandler | Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler. | errorHandlerLoggingLevel | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions. | errorHandlerLogStackTrace | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler. | explicitQosEnabled | boolean | Set if the deliveryMode priority or timeToLive qualities of service should be used when sending messages. This option is based on Spring's JmsTemplate. The deliveryMode priority and timeToLive options are applied to the current endpoint. This contrasts with the preserveMessageQos option which operates at message granularity reading QoS properties exclusively from the Camel In message headers. | exposeListenerSession | boolean | Specifies whether the listener session should be exposed when consuming messages. | idleTaskExecutionLimit | int | Specifies the limit for idle executions of a receive task not having received any message within its execution. If this limit is reached the task will shut down and leave receiving to other executing tasks (in the case of dynamic scheduling; see the maxConcurrentConsumers setting). There is additional doc available from Spring. | idleConsumerLimit | int | Specify the limit for the number of consumers that are allowed to be idle at any given time. | maxConcurrentConsumers | int | Specifies the maximum number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToMaxConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. | replyToMaxConcurrentConsumers | int | Specifies the maximum number of concurrent consumers when using request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. | replyOnTimeoutToMaxConcurrentConsumers | int | Specifies the maximum number of concurrent consumers for continue routing when timeout occurred when using request/reply over JMS. | maxMessagesPerTask | int | The number of messages per task. -1 is unlimited. If you use a range for concurrent consumers (eg min max) then this option can be used to set a value to eg 100 to control how fast the consumers will shrink when less work is required. | messageConverter | MessageConverter | To use a custom Spring org.springframework.jms.support.converter.MessageConverter so you can be in control how to map to/from a javax.jms.Message. | mapJmsMessage | boolean | Specifies whether Camel should auto map the received JMS message to a suited payload type such as javax.jms.TextMessage to a String etc. See section about how mapping works below for more details. | messageIdEnabled | boolean | When sending specifies whether message IDs should be added. | messageTimestampEnabled | boolean | Specifies whether timestamps should be enabled by default on sending messages. | alwaysCopyMessage | boolean | If true Camel will always make a JMS message copy of the message when it is passed to the producer for sending. Copying the message is needed in some situations such as when a replyToDestinationSelectorName is set (incidentally Camel will set the alwaysCopyMessage option to true if a replyToDestinationSelectorName is set) | useMessageIDAsCorrelationID | boolean | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | priority | int | Values greater than 1 specify the message priority when sending (where 0 is the lowest priority and 9 is the highest). The explicitQosEnabled option must also be enabled in order for this option to have any effect. | pubSubNoLocal | boolean | Specifies whether to inhibit the delivery of messages published by its own connection. | receiveTimeout | long | The timeout for receiving messages (in milliseconds). | recoveryInterval | long | Specifies the interval between recovery attempts i.e. when a connection is being refreshed in milliseconds. The default is 5000 ms that is 5 seconds. | subscriptionDurable | boolean | Deprecated: Enabled by default if you specify a durableSubscriptionName and a clientId. | taskExecutor | TaskExecutor | Allows you to specify a custom task executor for consuming messages. | timeToLive | long | When sending messages specifies the time-to-live of the message (in milliseconds). | transacted | boolean | Specifies whether to use transacted mode | lazyCreateTransactionManager | boolean | If true Camel will create a JmsTransactionManager if there is no transactionManager injected when option transacted=true. | transactionManager | PlatformTransactionManager | The Spring transaction manager to use. | transactionName | String | The name of the transaction to use. | transactionTimeout | int | The timeout value of the transaction (in seconds) if using transacted mode. | testConnectionOnStartup | boolean | Specifies whether to test the connection on startup. This ensures that when Camel starts that all the JMS consumers have a valid connection to the JMS broker. If a connection cannot be granted then Camel throws an exception on startup. This ensures that Camel is not started with failed connections. The JMS producers is tested as well. | asyncStartListener | boolean | Whether to startup the JmsConsumer message listener asynchronously when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true you will let routes startup while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used then beware that if the connection could not be established then an exception is logged at WARN level and the consumer will not be able to receive messages; You can then restart the route to retry. | asyncStopListener | boolean | Whether to stop the JmsConsumer message listener asynchronously when stopping a route. | forceSendOriginalMessage | boolean | When using mapJmsMessage=false Camel will create a new JMS message to send to a new JMS destination if you touch the headers (get or set) during the route. Set this option to true to force Camel to send the original JMS message that was received. | requestTimeout | long | The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). The default is 20 seconds. You can include the header CamelJmsRequestTimeout to override this endpoint configured timeout value and thus have per message individual timeout values. See also the requestTimeoutCheckerInterval option. | requestTimeoutCheckerInterval | long | Configures how often Camel should check for timed out Exchanges when doing request/reply over JMS. By default Camel checks once per second. But if you must react faster when a timeout occurs then you can lower this interval to check more frequently. The timeout is determined by the option requestTimeout. | transferExchange | boolean | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body Out body Fault body In headers Out headers Fault headers exchange properties exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side so Camel knows the payloads is an Exchange and not a regular payload. | transferException | boolean | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled this option takes precedence. The caught exception is required to be serializable. The original Exception on the consumer side can be wrapped in an outer exception such as org.apache.camel.RuntimeCamelException when returned to the producer. | transferFault | boolean | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side then the fault flag on link org.apache.camel.MessageisFault() will be send back in the response as a JMS header with the key link JmsConstantsJMS_TRANSFER_FAULT. If the client is Camel the returned fault flag will be set on the link org.apache.camel.MessagesetFault(boolean). You may want to enable this when using Camel components that support faults such as SOAP based such as cxf or spring-ws. | jmsOperations | JmsOperations | Allows you to use your own implementation of the org.springframework.jms.core.JmsOperations interface. Camel uses JmsTemplate as default. Can be used for testing purpose but not used much as stated in the spring API docs. | destinationResolver | DestinationResolver | A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example to lookup the real destination in a JNDI registry). | replyToType | ReplyToType | Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary Shared or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See Camel JMS documentation for more details and especially the notes about the implications if running in a clustered environment and the fact that Shared reply queues has lower performance than its alternatives Temporary and Exclusive. | preserveMessageQos | boolean | Set to true if you want to send message using the QoS settings specified on the message instead of the QoS settings on the JMS endpoint. The following three headers are considered JMSPriority JMSDeliveryMode and JMSExpiration. You can provide all or only some of them. If not provided Camel will fall back to use the values from the endpoint instead. So when using this option the headers override the values from the endpoint. The explicitQosEnabled option by contrast will only use options set on the endpoint and not values from the message header. | asyncConsumer | boolean | Whether the JmsConsumer processes the Exchange asynchronously. If enabled then the JmsConsumer may pickup the next message from the JMS queue while the previous message is being processed asynchronously (by the Asynchronous Routing Engine). This means that messages may be processed not 100 strictly in order. If disabled (as default) then the Exchange is fully processed before the JmsConsumer will pickup the next message from the JMS queue. Note if transacted has been enabled then asyncConsumer=true does not run asynchronously as transaction must be executed synchronously (Camel 3.0 may support async transactions). | allowNullBody | boolean | Whether to allow sending messages with no body. If this option is false and the message body is null then an JMSException is thrown. | includeSentJMSMessageID | boolean | Only applicable when sending to JMS destination using InOnly (eg fire and forget). Enabling this option will enrich the Camel Exchange with the actual JMSMessageID that was used by the JMS client when the message was sent to the JMS destination. | includeAllJMSXProperties | boolean | Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply. | defaultTaskExecutorType | DefaultTaskExecutorType | Specifies what default TaskExecutor type to use in the DefaultMessageListenerContainer for both consumer endpoints and the ReplyTo consumer of producer endpoints. Possible values: SimpleAsync (uses Spring's SimpleAsyncTaskExecutor) or ThreadPool (uses Spring's ThreadPoolTaskExecutor with optimal values - cached threadpool-like). If not set it defaults to the previous behaviour which uses a cached thread pool for consumer endpoints and SimpleAsync for reply consumers. The use of ThreadPool is recommended to reduce thread trash in elastic configurations with dynamically increasing and decreasing concurrent consumers. | jmsKeyFormatStrategy | JmsKeyFormatStrategy | Pluggable strategy for encoding and decoding JMS keys so they can be compliant with the JMS specification. Camel provides two implementations out of the box: default and passthrough. The default strategy will safely marshal dots and hyphens (. and -). The passthrough strategy leaves the key as is. Can be used for JMS brokers which do not care whether JMS header keys contain illegal characters. You can provide your own implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the notation. | applicationContext | ApplicationContext | Sets the Spring ApplicationContext to use | queueBrowseStrategy | QueueBrowseStrategy | To use a custom QueueBrowseStrategy when browsing queues | headerFilterStrategy | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message. | messageCreatedStrategy | MessageCreatedStrategy | To use the given MessageCreatedStrategy which are invoked when Camel creates new instances of javax.jms.Message objects when Camel is sending a JMS message. | waitForProvisionCorrelationToBeUpdatedCounter | int | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | waitForProvisionCorrelationToBeUpdatedThreadSleepingTime | long | Interval in millis to sleep each time while waiting for provisional correlation id to be updated. |======================================================================= {% endraw %} // component options: END [[JMS-Endpointoptions]] Endpoint options ++++++++++++++++ // endpoint options: START The JMS component supports 83 endpoint options which are listed below: {% raw %} [width="100%",cols="2,1,1m,1m,5",options="header"] |======================================================================= | Name | Group | Default | Java Type | Description | destinationType | common | queue | String | The kind of destination to use | destinationName | common | | String | *Required* Name of the queue or topic to use as destination | clientId | common | | String | Sets the JMS client ID to use. Note that this value if specified must be unique and can only be used by a single JMS connection instance. It is typically only required for durable topic subscriptions. If using Apache ActiveMQ you may prefer to use Virtual Topics instead. | connectionFactory | common | | ConnectionFactory | Sets the default connection factory to be used if a connection factory is not specified for either link setTemplateConnectionFactory(ConnectionFactory) or link setListenerConnectionFactory(ConnectionFactory) | disableReplyTo | common | false | boolean | If true a producer will behave like a InOnly exchange with the exception that JMSReplyTo header is sent out and not be suppressed like in the case of InOnly. Like InOnly the producer will not wait for a reply. A consumer with this flag will behave like InOnly. This feature can be used to bridge InOut requests to another queue so that a route on the other queue will send its response directly back to the original JMSReplyTo. | durableSubscriptionName | common | | String | The durable subscriber name for specifying durable topic subscriptions. The clientId option must be configured as well. | jmsMessageType | common | | JmsMessageType | Allows you to force the use of a specific javax.jms.Message implementation for sending JMS messages. Possible values are: Bytes Map Object Stream Text. By default Camel would determine which JMS message type to use from the In body type. This option allows you to specify it. | testConnectionOnStartup | common | false | boolean | Specifies whether to test the connection on startup. This ensures that when Camel starts that all the JMS consumers have a valid connection to the JMS broker. If a connection cannot be granted then Camel throws an exception on startup. This ensures that Camel is not started with failed connections. The JMS producers is tested as well. | acknowledgementModeName | consumer | AUTO_ACKNOWLEDGE | String | The JMS acknowledgement name which is one of: SESSION_TRANSACTED CLIENT_ACKNOWLEDGE AUTO_ACKNOWLEDGE DUPS_OK_ACKNOWLEDGE | asyncConsumer | consumer | false | boolean | Whether the JmsConsumer processes the Exchange asynchronously. If enabled then the JmsConsumer may pickup the next message from the JMS queue while the previous message is being processed asynchronously (by the Asynchronous Routing Engine). This means that messages may be processed not 100 strictly in order. If disabled (as default) then the Exchange is fully processed before the JmsConsumer will pickup the next message from the JMS queue. Note if transacted has been enabled then asyncConsumer=true does not run asynchronously as transaction must be executed synchronously (Camel 3.0 may support async transactions). | autoStartup | consumer | true | boolean | Specifies whether the consumer container should auto-startup. | bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored. | cacheLevelName | consumer | CACHE_AUTO | String | Sets the cache level by name for the underlying JMS resources. Possible values are: CACHE_AUTO CACHE_CONNECTION CACHE_CONSUMER CACHE_NONE and CACHE_SESSION. The default setting is CACHE_AUTO. See the Spring documentation and Transactions Cache Levels for more information. | concurrentConsumers | consumer | 1 | int | Specifies the default number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. | maxConcurrentConsumers | consumer | | int | Specifies the maximum number of concurrent consumers when consuming from JMS (not for request/reply over JMS). See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. When doing request/reply over JMS then the option replyToMaxConcurrentConsumers is used to control number of concurrent consumers on the reply message listener. | replyTo | consumer | | String | Provides an explicit ReplyTo destination which overrides any incoming value of Message.getJMSReplyTo(). | replyToDeliveryPersistent | consumer | true | boolean | Specifies whether to use persistent delivery by default for replies. | selector | consumer | | String | Sets the JMS selector to use | acceptMessagesWhileStopping | consumer (advanced) | false | boolean | Specifies whether the consumer accept messages while it is stopping. You may consider enabling this option if you start and stop JMS routes at runtime while there are still messages enqued on the queue. If this option is false and you stop the JMS route then messages may be rejected and the JMS broker would have to attempt redeliveries which yet again may be rejected and eventually the message may be moved at a dead letter queue on the JMS broker. To avoid this its recommended to enable this option. | allowReplyManagerQuickStop | consumer (advanced) | false | boolean | Whether the DefaultMessageListenerContainer used in the reply managers for request-reply messaging allow the DefaultMessageListenerContainer.runningAllowed flag to quick stop in case link JmsConfigurationisAcceptMessagesWhileStopping() is enabled and org.apache.camel.CamelContext is currently being stopped. This quick stop ability is enabled by default in the regular JMS consumers but to enable for reply managers you must enable this flag. | consumerType | consumer (advanced) | Default | ConsumerType | The consumer type to use which can be one of: Simple Default or Custom. The consumer type determines which Spring JMS listener to use. Default will use org.springframework.jms.listener.DefaultMessageListenerContainer Simple will use org.springframework.jms.listener.SimpleMessageListenerContainer. When Custom is specified the MessageListenerContainerFactory defined by the messageListenerContainerFactory option will determine what org.springframework.jms.listener.AbstractMessageListenerContainer to use. | defaultTaskExecutorType | consumer (advanced) | | DefaultTaskExecutorType | Specifies what default TaskExecutor type to use in the DefaultMessageListenerContainer for both consumer endpoints and the ReplyTo consumer of producer endpoints. Possible values: SimpleAsync (uses Spring's SimpleAsyncTaskExecutor) or ThreadPool (uses Spring's ThreadPoolTaskExecutor with optimal values - cached threadpool-like). If not set it defaults to the previous behaviour which uses a cached thread pool for consumer endpoints and SimpleAsync for reply consumers. The use of ThreadPool is recommended to reduce thread trash in elastic configurations with dynamically increasing and decreasing concurrent consumers. | eagerLoadingOfProperties | consumer (advanced) | false | boolean | Enables eager loading of JMS properties as soon as a message is loaded which generally is inefficient as the JMS properties may not be required but sometimes can catch early any issues with the underlying JMS provider and the use of JMS properties | exceptionHandler | consumer (advanced) | | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored. | exchangePattern | consumer (advanced) | | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange. | exposeListenerSession | consumer (advanced) | false | boolean | Specifies whether the listener session should be exposed when consuming messages. | replyToSameDestinationAllowed | consumer (advanced) | false | boolean | Whether a JMS consumer is allowed to send a reply message to the same destination that the consumer is using to consume from. This prevents an endless loop by consuming and sending back the same message to itself. | deliveryMode | producer | | Integer | Specifies the delivery mode to be used. Possibles values are those defined by javax.jms.DeliveryMode. NON_PERSISTENT = 1 and PERSISTENT = 2. | deliveryPersistent | producer | true | boolean | Specifies whether persistent delivery is used by default. | explicitQosEnabled | producer | false | Boolean | Set if the deliveryMode priority or timeToLive qualities of service should be used when sending messages. This option is based on Spring's JmsTemplate. The deliveryMode priority and timeToLive options are applied to the current endpoint. This contrasts with the preserveMessageQos option which operates at message granularity reading QoS properties exclusively from the Camel In message headers. | preserveMessageQos | producer | false | boolean | Set to true if you want to send message using the QoS settings specified on the message instead of the QoS settings on the JMS endpoint. The following three headers are considered JMSPriority JMSDeliveryMode and JMSExpiration. You can provide all or only some of them. If not provided Camel will fall back to use the values from the endpoint instead. So when using this option the headers override the values from the endpoint. The explicitQosEnabled option by contrast will only use options set on the endpoint and not values from the message header. | priority | producer | 4 | int | Values greater than 1 specify the message priority when sending (where 0 is the lowest priority and 9 is the highest). The explicitQosEnabled option must also be enabled in order for this option to have any effect. | replyToConcurrentConsumers | producer | 1 | int | Specifies the default number of concurrent consumers when doing request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. | replyToMaxConcurrentConsumers | producer | | int | Specifies the maximum number of concurrent consumers when using request/reply over JMS. See also the maxMessagesPerTask option to control dynamic scaling up/down of threads. | replyToOnTimeoutMaxConcurrentConsumers | producer | 1 | int | Specifies the maximum number of concurrent consumers for continue routing when timeout occurred when using request/reply over JMS. | replyToOverride | producer | | String | Provides an explicit ReplyTo destination in the JMS message which overrides the setting of replyTo. It is useful if you want to forward the message to a remote Queue and receive the reply message from the ReplyTo destination. | replyToType | producer | | ReplyToType | Allows for explicitly specifying which kind of strategy to use for replyTo queues when doing request/reply over JMS. Possible values are: Temporary Shared or Exclusive. By default Camel will use temporary queues. However if replyTo has been configured then Shared is used by default. This option allows you to use exclusive queues instead of shared ones. See Camel JMS documentation for more details and especially the notes about the implications if running in a clustered environment and the fact that Shared reply queues has lower performance than its alternatives Temporary and Exclusive. | requestTimeout | producer | 20000 | long | The timeout for waiting for a reply when using the InOut Exchange Pattern (in milliseconds). The default is 20 seconds. You can include the header CamelJmsRequestTimeout to override this endpoint configured timeout value and thus have per message individual timeout values. See also the requestTimeoutCheckerInterval option. | timeToLive | producer | -1 | long | When sending messages specifies the time-to-live of the message (in milliseconds). | allowNullBody | producer (advanced) | true | boolean | Whether to allow sending messages with no body. If this option is false and the message body is null then an JMSException is thrown. | alwaysCopyMessage | producer (advanced) | false | boolean | If true Camel will always make a JMS message copy of the message when it is passed to the producer for sending. Copying the message is needed in some situations such as when a replyToDestinationSelectorName is set (incidentally Camel will set the alwaysCopyMessage option to true if a replyToDestinationSelectorName is set) | disableTimeToLive | producer (advanced) | false | boolean | Use this option to force disabling time to live. For example when you do request/reply over JMS then Camel will by default use the requestTimeout value as time to live on the message being sent. The problem is that the sender and receiver systems have to have their clocks synchronized so they are in sync. This is not always so easy to archive. So you can use disableTimeToLive=true to not set a time to live value on the sent message. Then the message will not expire on the receiver system. See below in section About time to live for more details. | forceSendOriginalMessage | producer (advanced) | false | boolean | When using mapJmsMessage=false Camel will create a new JMS message to send to a new JMS destination if you touch the headers (get or set) during the route. Set this option to true to force Camel to send the original JMS message that was received. | includeSentJMSMessageID | producer (advanced) | false | boolean | Only applicable when sending to JMS destination using InOnly (eg fire and forget). Enabling this option will enrich the Camel Exchange with the actual JMSMessageID that was used by the JMS client when the message was sent to the JMS destination. | replyToCacheLevelName | producer (advanced) | | String | Sets the cache level by name for the reply consumer when doing request/reply over JMS. This option only applies when using fixed reply queues (not temporary). Camel will by default use: CACHE_CONSUMER for exclusive or shared w/ replyToSelectorName. And CACHE_SESSION for shared without replyToSelectorName. Some JMS brokers such as IBM WebSphere may require to set the replyToCacheLevelName=CACHE_NONE to work. Note: If using temporary queues then CACHE_NONE is not allowed and you must use a higher value such as CACHE_CONSUMER or CACHE_SESSION. | replyToDestinationSelectorName | producer (advanced) | | String | Sets the JMS Selector using the fixed name to be used so you can filter out your own replies from the others when using a shared queue (that is if you are not using a temporary reply queue). | asyncStartListener | advanced | false | boolean | Whether to startup the JmsConsumer message listener asynchronously when starting a route. For example if a JmsConsumer cannot get a connection to a remote JMS broker then it may block while retrying and/or failover. This will cause Camel to block while starting routes. By setting this option to true you will let routes startup while the JmsConsumer connects to the JMS broker using a dedicated thread in asynchronous mode. If this option is used then beware that if the connection could not be established then an exception is logged at WARN level and the consumer will not be able to receive messages; You can then restart the route to retry. | asyncStopListener | advanced | false | boolean | Whether to stop the JmsConsumer message listener asynchronously when stopping a route. | destinationResolver | advanced | | DestinationResolver | A pluggable org.springframework.jms.support.destination.DestinationResolver that allows you to use your own resolver (for example to lookup the real destination in a JNDI registry). | errorHandler | advanced | | ErrorHandler | Specifies a org.springframework.util.ErrorHandler to be invoked in case of any uncaught exceptions thrown while processing a Message. By default these exceptions will be logged at the WARN level if no errorHandler has been configured. You can configure logging level and whether stack traces should be logged using errorHandlerLoggingLevel and errorHandlerLogStackTrace options. This makes it much easier to configure than having to code a custom errorHandler. | errorHandlerLoggingLevel | advanced | WARN | LoggingLevel | Allows to configure the default errorHandler logging level for logging uncaught exceptions. | errorHandlerLogStackTrace | advanced | true | boolean | Allows to control whether stacktraces should be logged or not by the default errorHandler. | exceptionListener | advanced | | ExceptionListener | Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions. | headerFilterStrategy | advanced | | HeaderFilterStrategy | To use a custom HeaderFilterStrategy to filter header to and from Camel message. | idleConsumerLimit | advanced | 1 | int | Specify the limit for the number of consumers that are allowed to be idle at any given time. | idleTaskExecutionLimit | advanced | 1 | int | Specifies the limit for idle executions of a receive task not having received any message within its execution. If this limit is reached the task will shut down and leave receiving to other executing tasks (in the case of dynamic scheduling; see the maxConcurrentConsumers setting). There is additional doc available from Spring. | includeAllJMSXProperties | advanced | false | boolean | Whether to include all JMSXxxx properties when mapping from JMS to Camel Message. Setting this to true will include properties such as JMSXAppID and JMSXUserID etc. Note: If you are using a custom headerFilterStrategy then this option does not apply. | jmsKeyFormatStrategy | advanced | | String | Pluggable strategy for encoding and decoding JMS keys so they can be compliant with the JMS specification. Camel provides two implementations out of the box: default and passthrough. The default strategy will safely marshal dots and hyphens (. and -). The passthrough strategy leaves the key as is. Can be used for JMS brokers which do not care whether JMS header keys contain illegal characters. You can provide your own implementation of the org.apache.camel.component.jms.JmsKeyFormatStrategy and refer to it using the notation. | mapJmsMessage | advanced | true | boolean | Specifies whether Camel should auto map the received JMS message to a suited payload type such as javax.jms.TextMessage to a String etc. | maxMessagesPerTask | advanced | -1 | int | The number of messages per task. -1 is unlimited. If you use a range for concurrent consumers (eg min max) then this option can be used to set a value to eg 100 to control how fast the consumers will shrink when less work is required. | messageConverter | advanced | | MessageConverter | To use a custom Spring org.springframework.jms.support.converter.MessageConverter so you can be in control how to map to/from a javax.jms.Message. | messageCreatedStrategy | advanced | | MessageCreatedStrategy | To use the given MessageCreatedStrategy which are invoked when Camel creates new instances of javax.jms.Message objects when Camel is sending a JMS message. | messageIdEnabled | advanced | true | boolean | When sending specifies whether message IDs should be added. This is just an hint to the JMS Broker. If the JMS provider accepts this hint these messages must have the message ID set to null; if the provider ignores the hint the message ID must be set to its normal unique value | messageListenerContainerFactory | advanced | | MessageListenerContainerFactory | Registry ID of the MessageListenerContainerFactory used to determine what org.springframework.jms.listener.AbstractMessageListenerContainer to use to consume messages. Setting this will automatically set consumerType to Custom. | messageTimestampEnabled | advanced | true | boolean | Specifies whether timestamps should be enabled by default on sending messages. This is just an hint to the JMS Broker. If the JMS provider accepts this hint these messages must have the timestamp set to zero; if the provider ignores the hint the timestamp must be set to its normal value | pubSubNoLocal | advanced | false | boolean | Specifies whether to inhibit the delivery of messages published by its own connection. | receiveTimeout | advanced | 1000 | long | The timeout for receiving messages (in milliseconds). | recoveryInterval | advanced | 5000 | long | Specifies the interval between recovery attempts i.e. when a connection is being refreshed in milliseconds. The default is 5000 ms that is 5 seconds. | requestTimeoutCheckerInterval | advanced | 1000 | long | Configures how often Camel should check for timed out Exchanges when doing request/reply over JMS. By default Camel checks once per second. But if you must react faster when a timeout occurs then you can lower this interval to check more frequently. The timeout is determined by the option requestTimeout. | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported). | transferException | advanced | false | boolean | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed on the consumer side then the caused Exception will be send back in response as a javax.jms.ObjectMessage. If the client is Camel the returned Exception is rethrown. This allows you to use Camel JMS as a bridge in your routing - for example using persistent queues to enable robust routing. Notice that if you also have transferExchange enabled this option takes precedence. The caught exception is required to be serializable. The original Exception on the consumer side can be wrapped in an outer exception such as org.apache.camel.RuntimeCamelException when returned to the producer. | transferExchange | advanced | false | boolean | You can transfer the exchange over the wire instead of just the body and headers. The following fields are transferred: In body Out body Fault body In headers Out headers Fault headers exchange properties exchange exception. This requires that the objects are serializable. Camel will exclude any non-serializable objects and log it at WARN level. You must enable this option on both the producer and consumer side so Camel knows the payloads is an Exchange and not a regular payload. | transferFault | advanced | false | boolean | If enabled and you are using Request Reply messaging (InOut) and an Exchange failed with a SOAP fault (not exception) on the consumer side then the fault flag on link org.apache.camel.MessageisFault() will be send back in the response as a JMS header with the key link JmsConstantsJMS_TRANSFER_FAULT. If the client is Camel the returned fault flag will be set on the link org.apache.camel.MessagesetFault(boolean). You may want to enable this when using Camel components that support faults such as SOAP based such as cxf or spring-ws. | useMessageIDAsCorrelationID | advanced | false | boolean | Specifies whether JMSMessageID should always be used as JMSCorrelationID for InOut messages. | waitForProvisionCorrelationToBeUpdatedCounter | advanced | 50 | int | Number of times to wait for provisional correlation id to be updated to the actual correlation id when doing request/reply over JMS and when the option useMessageIDAsCorrelationID is enabled. | waitForProvisionCorrelationToBeUpdatedThreadSleepingTime | advanced | 100 | long | Interval in millis to sleep each time while waiting for provisional correlation id to be updated. | password | security | | String | Password to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | username | security | | String | Username to use with the ConnectionFactory. You can also configure username/password directly on the ConnectionFactory. | transacted | transaction | false | boolean | Specifies whether to use transacted mode | lazyCreateTransactionManager | transaction (advanced) | true | boolean | If true Camel will create a JmsTransactionManager if there is no transactionManager injected when option transacted=true. | transactionManager | transaction (advanced) | | PlatformTransactionManager | The Spring transaction manager to use. | transactionName | transaction (advanced) | | String | The name of the transaction to use. | transactionTimeout | transaction (advanced) | -1 | int | The timeout value of the transaction (in seconds) if using transacted mode. |======================================================================= {% endraw %} // endpoint options: END [[JMS-MessageMappingbetweenJMSandCamel]] Message Mapping between JMS and Camel ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Camel automatically maps messages between `javax.jms.Message` and `org.apache.camel.Message`. When sending a JMS message, Camel converts the message body to the following JMS message types: [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |Body Type |JMS Message |Comment |`String` |`javax.jms.TextMessage` |?? |`org.w3c.dom.Node` |`javax.jms.TextMessage` |The DOM will be converted to `String`. |`Map` |`javax.jms.MapMessage` |?? |`java.io.Serializable` |`javax.jms.ObjectMessage` |?? |`byte[]` |`javax.jms.BytesMessage` |?? |`java.io.File` |`javax.jms.BytesMessage` |?? |`java.io.Reader` |`javax.jms.BytesMessage` |?? |`java.io.InputStream` |`javax.jms.BytesMessage` |?? |`java.nio.ByteBuffer` |`javax.jms.BytesMessage` |?? |======================================================================= When receiving a JMS message, Camel converts the JMS message to the following body type: [width="100%",cols="50%,50%",options="header",] |============================================= |JMS Message |Body Type |`javax.jms.TextMessage` |`String` |`javax.jms.BytesMessage` |`byte[]` |`javax.jms.MapMessage` |`Map` |`javax.jms.ObjectMessage` |`Object` |============================================= [[JMS-Disablingauto-mappingofJMSmessages]] Disabling auto-mapping of JMS messages ++++++++++++++++++++++++++++++++++++++ You can use the `mapJmsMessage` option to disable the auto-mapping above. If disabled, Camel will not try to map the received JMS message, but instead uses it directly as the payload. This allows you to avoid the overhead of mapping and let Camel just pass through the JMS message. For instance, it even allows you to route `javax.jms.ObjectMessage` JMS messages with classes you do *not* have on the classpath. [[JMS-UsingacustomMessageConverter]] Using a custom MessageConverter +++++++++++++++++++++++++++++++ You can use the `messageConverter` option to do the mapping yourself in a Spring `org.springframework.jms.support.converter.MessageConverter` class. For example, in the route below we use a custom message converter when sending a message to the JMS order queue: [source,java] ---------------------------------------------------------------------------------------- from("file://inbox/order").to("jms:queue:order?messageConverter=#myMessageConverter"); ---------------------------------------------------------------------------------------- You can also use a custom message converter when consuming from a JMS destination. [[JMS-Controllingthemappingstrategyselected]] Controlling the mapping strategy selected +++++++++++++++++++++++++++++++++++++++++ You can use the `jmsMessageType` option on the endpoint URL to force a specific message type for all messages. In the route below, we poll files from a folder and send them as `javax.jms.TextMessage` as we have forced the JMS producer endpoint to use text messages: [source,java] ----------------------------------------------------------------------- from("file://inbox/order").to("jms:queue:order?jmsMessageType=Text"); ----------------------------------------------------------------------- You can also specify the message type to use for each message by setting the header with the key `CamelJmsMessageType`. For example: [source,java] --------------------------------------------------------------------------------------------------------- from("file://inbox/order").setHeader("CamelJmsMessageType", JmsMessageType.Text).to("jms:queue:order"); --------------------------------------------------------------------------------------------------------- The possible values are defined in the `enum` class, `org.apache.camel.jms.JmsMessageType`. [[JMS-Messageformatwhensending]] Message format when sending ^^^^^^^^^^^^^^^^^^^^^^^^^^^ The exchange that is sent over the JMS wire must conform to the http://java.sun.com/j2ee/1.4/docs/api/javax/jms/Message.html[JMS Message spec]. For the `exchange.in.header` the following rules apply for the header **keys**: * Keys starting with `JMS` or `JMSX` are reserved. * `exchange.in.headers` keys must be literals and all be valid Java identifiers (do not use dots in the key name). * Camel replaces dots & hyphens and the reverse when when consuming JMS messages: + `.` is replaced by `_DOT_` and the reverse replacement when Camel consumes the message. + `-` is replaced by `_HYPHEN_` and the reverse replacement when Camel consumes the message. * See also the option `jmsKeyFormatStrategy`, which allows use of your own custom strategy for formatting keys. For the `exchange.in.header`, the following rules apply for the header **values**: * The values must be primitives or their counter objects (such as `Integer`, `Long`, `Character`). The types, `String`, `CharSequence`, `Date`, `BigDecimal` and `BigInteger` are all converted to their `toString()` representation. All other types are dropped. Camel will log with category `org.apache.camel.component.jms.JmsBinding` at *DEBUG* level if it drops a given header value. For example: ---------------------------------------------------------------------------------------------------------------------------------------------------------------- 2008-07-09 06:43:04,046 [main ] DEBUG JmsBinding - Ignoring non primitive header: order of class: org.apache.camel.component.jms.issues.DummyOrder with value: DummyOrder{orderId=333, itemId=4444, quantity=2} ---------------------------------------------------------------------------------------------------------------------------------------------------------------- [[JMS-Messageformatwhenreceiving]] Message format when receiving ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Camel adds the following properties to the `Exchange` when it receives a message: [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |Property |Type |Description |`org.apache.camel.jms.replyDestination` |`javax.jms.Destination` |The reply destination. |======================================================================= Camel adds the following JMS properties to the In message headers when it receives a JMS message: [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |Header |Type |Description |`JMSCorrelationID` |`String` |The JMS correlation ID. |`JMSDeliveryMode` |`int` |The JMS delivery mode. |`JMSDestination` |`javax.jms.Destination` |The JMS destination. |`JMSExpiration` |`long` |The JMS expiration. |`JMSMessageID` |`String` |The JMS unique message ID. |`JMSPriority` |`int` |The JMS priority (with 0 as the lowest priority and 9 as the highest). |`JMSRedelivered` |`boolean` |Is the JMS message redelivered. |`JMSReplyTo` |`javax.jms.Destination` |The JMS reply-to destination. |`JMSTimestamp` |`long` |The JMS timestamp. |`JMSType` |`String` |The JMS type. |`JMSXGroupID` |`String` |The JMS group ID. |======================================================================= As all the above information is standard JMS you can check the http://java.sun.com/javaee/5/docs/api/javax/jms/Message.html[JMS documentation] for further details. [[JMS-AboutusingCameltosendandreceivemessagesandJMSReplyTo]] About using Camel to send and receive messages and JMSReplyTo ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The JMS component is complex and you have to pay close attention to how it works in some cases. So this is a short summary of some of the areas/pitfalls to look for. When Camel sends a message using its `JMSProducer`, it checks the following conditions: * The message exchange pattern, * Whether a `JMSReplyTo` was set in the endpoint or in the message headers, * Whether any of the following options have been set on the JMS endpoint: `disableReplyTo`, `preserveMessageQos`, `explicitQosEnabled`. All this can be a tad complex to understand and configure to support your use case. [[JMS-JmsProducer]] JmsProducer +++++++++++ The `JmsProducer` behaves as follows, depending on configuration: [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |Exchange Pattern |Other options |Description |_InOut_ |- |Camel will expect a reply, set a temporary `JMSReplyTo`, and after sending the message, it will start to listen for the reply message on the temporary queue. |_InOut_ |`JMSReplyTo` is set |Camel will expect a reply and, after sending the message, it will start to listen for the reply message on the specified `JMSReplyTo` queue. |_InOnly_ |- |Camel will send the message and *not* expect a reply. |_InOnly_ |`JMSReplyTo` is set |By default, Camel discards the `JMSReplyTo` destination and clears the `JMSReplyTo` header before sending the message. Camel then sends the message and does *not* expect a reply. Camel logs this in the log at `WARN` level (changed to `DEBUG` level from *Camel 2.6* onwards. You can use `preserveMessageQuo=true` to instruct Camel to keep the `JMSReplyTo`. In all situations the `JmsProducer` does *not* expect any reply and thus continue after sending the message. |======================================================================= [[JMS-JmsConsumer]] JmsConsumer +++++++++++ The `JmsConsumer` behaves as follows, depending on configuration: [width="100%",cols="10%,10%,80%",options="header",] |======================================================================= |Exchange Pattern |Other options |Description |_InOut_ |- |Camel will send the reply back to the `JMSReplyTo` queue. |_InOnly_ |- |Camel will not send a reply back, as the pattern is __InOnly__. |- |`disableReplyTo=true` |This option suppresses replies. |======================================================================= So pay attention to the message exchange pattern set on your exchanges. If you send a message to a JMS destination in the middle of your route you can specify the exchange pattern to use, see more at link:request-reply.html[Request Reply]. + This is useful if you want to send an `InOnly` message to a JMS topic: [source,java] ------------------------------------------------------ from("activemq:queue:in") .to("bean:validateOrder") .to(ExchangePattern.InOnly, "activemq:topic:order") .to("bean:handleOrder"); ------------------------------------------------------ [[JMS-Reuseendpointandsendtodifferentdestinationscomputedatruntime]] Reuse endpoint and send to different destinations computed at runtime ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If you need to send messages to a lot of different JMS destinations, it makes sense to reuse a JMS endpoint and specify the real destination in a message header. This allows Camel to reuse the same endpoint, but send to different destinations. This greatly reduces the number of endpoints created and economizes on memory and thread resources. You can specify the destination in the following headers: [width="100%",cols="10%,10%,80%",options="header",] |===================================================================== |Header |Type |Description |`CamelJmsDestination` |`javax.jms.Destination` |A destination object. |`CamelJmsDestinationName` |`String` |The destination name. |===================================================================== For example, the following route shows how you can compute a destination at run time and use it to override the destination appearing in the JMS URL: [source,java] -------------------------------- from("file://inbox") .to("bean:computeDestination") .to("activemq:queue:dummy"); -------------------------------- The queue name, `dummy`, is just a placeholder. It must be provided as part of the JMS endpoint URL, but it will be ignored in this example. In the `computeDestination` bean, specify the real destination by setting the `CamelJmsDestinationName` header as follows: [source,java] ------------------------------------------------------------------------- public void setJmsHeader(Exchange exchange) { String id = .... exchange.getIn().setHeader("CamelJmsDestinationName", "order:" + id"); } ------------------------------------------------------------------------- Then Camel will read this header and use it as the destination instead of the one configured on the endpoint. So, in this example Camel sends the message to `activemq:queue:order:2`, assuming the `id` value was 2. If both the `CamelJmsDestination` and the `CamelJmsDestinationName` headers are set, `CamelJmsDestination` takes priority. Keep in mind that the JMS producer removes both `CamelJmsDestination` and `CamelJmsDestinationName` headers from the exchange and do not propagate them to the created JMS message??in order to avoid the accidental loops in the routes (in scenarios when the message will be forwarded to the another JMS endpoint). [[JMS-ConfiguringdifferentJMSproviders]] Configuring different JMS providers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ You can configure your JMS provider in link:spring.html[Spring] XML as follows: Basically, you can configure as many JMS component instances as you wish and give them *a unique name using the* `id` **attribute**. The preceding example configures an `activemq` component. You could do the same to configure MQSeries, TibCo, BEA, Sonic and so on. Once you have a named JMS component, you can then refer to endpoints within that component using URIs. For example for the component name, `activemq`, you can then refer to destinations using the URI format, `activemq:[queue:|topic:]destinationName`. You can use the same approach for all other JMS providers. This works by the SpringCamelContext lazily fetching components from the spring context for the scheme name you use for link:endpoint.html[Endpoint] link:uris.html[URIs] and having the link:component.html[Component] resolve the endpoint URIs. [[JMS-UsingJNDItofindtheConnectionFactory]] Using JNDI to find the ConnectionFactory ++++++++++++++++++++++++++++++++++++++++ If you are using a J2EE container, you might need to look up JNDI to find the JMS `ConnectionFactory` rather than use the usual `` mechanism in Spring. You can do this using Spring's factory bean or the new Spring XML namespace. For example: [source,xml] ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- See http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/xsd-config.html#xsd-config-body-schemas-jee[The jee schema] in the Spring reference documentation for more details about JNDI lookup. [[JMS-ConcurrentConsuming]] Concurrent Consuming ^^^^^^^^^^^^^^^^^^^^ A common requirement with JMS is to consume messages concurrently in multiple threads in order to make an application more responsive. You can set the `concurrentConsumers` option to specify the number of threads servicing the JMS endpoint, as follows: [source,java] --------------------------------------------- from("jms:SomeQueue?concurrentConsumers=20"). bean(MyClass.class); --------------------------------------------- You can configure this option in one of the following ways: * On the `JmsComponent`, * On the endpoint URI or, * By invoking `setConcurrentConsumers()` directly on the `JmsEndpoint`. [[JMS-ConcurrentConsumingwithasyncconsumer]] Concurrent Consuming with async consumer ++++++++++++++++++++++++++++++++++++++++ Notice that each concurrent consumer will only pickup the next available message from the JMS broker, when the current message has been fully processed. You can set the option `asyncConsumer=true` to let the consumer pickup the next message from the JMS queue, while the previous message is being processed asynchronously (by the link:asynchronous-routing-engine.html[Asynchronous Routing Engine]). See more details in the table on top of the page about the `asyncConsumer` option. [source,java] ---------------------------------------------------------------- from("jms:SomeQueue?concurrentConsumers=20&asyncConsumer=true"). bean(MyClass.class); ---------------------------------------------------------------- [[JMS-Request-replyoverJMS]] Request-reply over JMS ^^^^^^^^^^^^^^^^^^^^^^ Camel supports link:request-reply.html[Request Reply] over JMS. In essence the MEP of the Exchange should be `InOut` when you send a message to a JMS queue. Camel offers a number of options to configure request/reply over JMS that influence performance and clustered environments. The table below summaries the options. [width="100%",cols="10%,10%,10%,70%",options="header",] |======================================================================= |Option |Performance |Cluster |Description |`Temporary` |Fast |Yes |A temporary queue is used as reply queue, and automatic created by Camel. To use this do *not* specify a replyTo queue name. And you can optionally configure `replyToType=Temporary` to make it stand out that temporary queues are in use. |`Shared` |Slow |Yes |A shared persistent queue is used as reply queue. The queue must be created beforehand, although some brokers can create them on the fly such as Apache ActiveMQ. To use this you must specify the replyTo queue name. And you can optionally configure `replyToType=Shared` to make it stand out that shared queues are in use. A shared queue can be used in a clustered environment with multiple nodes running this Camel application at the same time. All using the same shared reply queue. This is possible because JMS Message selectors are used to correlate expected reply messages; this impacts performance though. JMS Message selectors is slower, and therefore not as fast as `Temporary` or `Exclusive` queues. See further below how to tweak this for better performance. |`Exclusive` |Fast |No (*Yes) |An exclusive persistent queue is used as reply queue. The queue must be created beforehand, although some brokers can create them on the fly such as Apache ActiveMQ. To use this you must specify the replyTo queue name. And you *must* configure `replyToType=Exclusive` to instruct Camel to use exclusive queues, as `Shared` is used by default, if a `replyTo` queue name was configured. When using exclusive reply queues, then JMS Message selectors are *not* in use, and therefore other applications must not use this queue as well. An exclusive queue *cannot* be used in a clustered environment with multiple nodes running this Camel application at the same time; as we do not have control if the reply queue comes back to the same node that sent the request message; that is why shared queues use JMS Message selectors to make sure of this. *Though* if you configure each Exclusive reply queue with an unique name per node, then you can run this in a clustered environment. As then the reply message will be sent back to that queue for the given node, that awaits the reply message. |`concurrentConsumers` |Fast |Yes |*Camel 2.10.3:* Allows to process reply messages concurrently using concurrent message listeners in use. You can specify a range using the `concurrentConsumers` and `maxConcurrentConsumers` options. *Notice:* That using `Shared` reply queues may not work as well with concurrent listeners, so use this option with care. |`maxConcurrentConsumers` |Fast |Yes |*Camel 2.10.3:* Allows to process reply messages concurrently using concurrent message listeners in use. You can specify a range using the `concurrentConsumers` and `maxConcurrentConsumers` options. *Notice:* That using `Shared` reply queues may not work as well with concurrent listeners, so use this option with care. |======================================================================= The `JmsProducer` detects the `InOut` and provides a `JMSReplyTo` header with the reply destination to be used. By default Camel uses a temporary queue, but you can use the `replyTo` option on the endpoint to specify a fixed reply queue (see more below about fixed reply queue). Camel will automatic setup a consumer which listen on the reply queue, so you should *not* do anything. + This consumer is a Spring `DefaultMessageListenerContainer` which listen for replies. However it's fixed to 1 concurrent consumer. + That means replies will be processed in sequence as there are only 1 thread to process the replies. If you want to process replies faster, then we need to use concurrency. But *not* using the `concurrentConsumer` option. We should use the `threads` from the Camel DSL instead, as shown in the route below: Instead of using threads, then use concurrentConsumers option if using Camel 2.10.3 or better. See further below. [source,java] --------------------------------- from(xxx) .inOut().to("activemq:queue:foo") .threads(5) .to(yyy) .to(zzz); --------------------------------- In this route we instruct Camel to route replies link:async.html[asynchronously] using a thread pool with 5 threads. From *Camel 2.10.3* onwards you can now configure the listener to use concurrent threads using the `concurrentConsumers` and `maxConcurrentConsumers` options. This allows you to easier configure this in Camel as shown below: [source,java] ------------------------------------------------------- from(xxx) .inOut().to("activemq:queue:foo?concurrentConsumers=5") .to(yyy) .to(zzz); ------------------------------------------------------- [[JMS-Request-replyoverJMSandusingasharedfixedreplyqueue]] Request-reply over JMS and using a shared fixed reply queue +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If you use a fixed reply queue when doing link:request-reply.html[Request Reply] over JMS as shown in the example below, then pay attention. [source,java] --------------------------------------------- from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar") .to(yyy) --------------------------------------------- In this example the fixed reply queue named "bar" is used. By default Camel assumes the queue is shared when using fixed reply queues, and therefore it uses a `JMSSelector` to only pickup the expected reply messages (eg based on the `JMSCorrelationID`). See next section for exclusive fixed reply queues. That means its not as fast as temporary queues. You can speedup how often Camel will pull for reply messages using the `receiveTimeout` option. By default its 1000 millis. So to make it faster you can set it to 250 millis to pull 4 times per second as shown: [source,java] ---------------------------------------------------------------- from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar&receiveTimeout=250") .to(yyy) ---------------------------------------------------------------- Notice this will cause the Camel to send pull requests to the message broker more frequent, and thus require more network traffic. + It is generally recommended to use temporary queues if possible. [[JMS-Request-replyoverJMSandusinganexclusivefixedreplyqueue]] Request-reply over JMS and using an exclusive fixed reply queue +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *Available as of Camel 2.9* In the previous example, Camel would anticipate the fixed reply queue named "bar" was shared, and thus it uses a `JMSSelector` to only consume reply messages which it expects. However there is a drawback doing this as JMS selectos is slower. Also the consumer on the reply queue is slower to update with new JMS selector ids. In fact it only updates when the `receiveTimeout` option times out, which by default is 1 second. So in theory the reply messages could take up till about 1 sec to be detected. On the other hand if the fixed reply queue is exclusive to the Camel reply consumer, then we can avoid using the JMS selectors, and thus be more performant. In fact as fast as using temporary queues. So in *Camel 2.9* onwards we introduced the `ReplyToType` option which you can configure to `Exclusive` + to tell Camel that the reply queue is exclusive as shown in the example below: [source,java] ------------------------------------------------------------------- from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar&replyToType=Exclusive") .to(yyy) ------------------------------------------------------------------- Mind that the queue must be exclusive to each and every endpoint. So if you have two routes, then they each need an unique reply queue as shown in the next example: [source,java] ----------------------------------------------------------------------------- from(xxx) .inOut().to("activemq:queue:foo?replyTo=bar&replyToType=Exclusive") .to(yyy) from(aaa) .inOut().to("activemq:queue:order?replyTo=order.reply&replyToType=Exclusive") .to(bbb) ----------------------------------------------------------------------------- The same applies if you run in a clustered environment. Then each node in the cluster must use an unique reply queue name. As otherwise each node in the cluster may pickup messages which was intended as a reply on another node. For clustered environments its recommended to use shared reply queues instead. [[JMS-Synchronizingclocksbetweensendersandreceivers]] Synchronizing clocks between senders and receivers ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When doing messaging between systems, its desirable that the systems have synchronized clocks. For example when sending a link:jms.html[JMS] message, then you can set a time to live value on the message. Then the receiver can inspect this value, and determine if the message is already expired, and thus drop the message instead of consume and process it. However this requires that both sender and receiver have synchronized clocks. If you are using http://activemq.apache.org/[ActiveMQ] then you can use the http://activemq.apache.org/timestampplugin.html[timestamp plugin] to synchronize clocks. [[JMS-Abouttimetolive]] About time to live ^^^^^^^^^^^^^^^^^^ Read first above about synchronized clocks. When you do request/reply (InOut) over link:jms.html[JMS] with Camel then Camel uses a timeout on the sender side, which is default 20 seconds from the `requestTimeout` option. You can control this by setting a higher/lower value. However the time to live value is still set on the link:jms.html[JMS] message being send. So that requires the clocks to be synchronized between the systems. If they are not, then you may want to disable the time to live value being set. This is now possible using the `disableTimeToLive` option from *Camel 2.8* onwards. So if you set this option to `disableTimeToLive=true`, then Camel does *not* set any time to live value when sending link:jms.html[JMS] messages. *But* the request timeout is still active. So for example if you do request/reply over link:jms.html[JMS] and have disabled time to live, then Camel will still use a timeout by 20 seconds (the `requestTimeout` option). That option can of course also be configured. So the two options `requestTimeout` and `disableTimeToLive` gives you fine grained control when doing request/reply. From *Camel 2.13/2.12.3* onwards you can provide a header in the message to override and use as the request timeout value instead of the endpoint configured value. For example: [source,java] -------------------------------------------------------- from("direct:someWhere") .to("jms:queue:foo?replyTo=bar&requestTimeout=30s") .to("bean:processReply"); -------------------------------------------------------- In the route above we have a endpoint configured `requestTimeout` of 30 seconds. So Camel will wait up till 30 seconds for that reply message to come back on the bar queue. If no reply message is received then a `org.apache.camel.ExchangeTimedOutException` is set on the link:exchange.html[Exchange] and Camel continues routing the message, which would then fail due the exception, and Camel's error handler reacts. If you want to use a per message timeout value, you can set the header with key `org.apache.camel.component.jms.JmsConstants#JMS_REQUEST_TIMEOUT` which has constant value `"CamelJmsRequestTimeout"` with a timeout value as long type. For example we can use a bean to compute the timeout value per individual message, such as calling the `"whatIsTheTimeout"` method on the service bean as shown below: [source,java] ---------------------------------------------------------------------------------------- from("direct:someWhere") .setHeader("CamelJmsRequestTimeout", method(ServiceBean.class, "whatIsTheTimeout")) .to("jms:queue:foo?replyTo=bar&requestTimeout=30s") .to("bean:processReply"); ---------------------------------------------------------------------------------------- When you do fire and forget (InOut) over link:jms.html[JMS] with Camel then Camel by default does *not* set any time to live value on the message. You can configure a value by using the `timeToLive` option. For example to indicate a 5 sec., you set `timeToLive=5000`. The option `disableTimeToLive` can be used to force disabling the time to live, also for InOnly messaging. The `requestTimeout` option is not being used for InOnly messaging. [[JMS-EnablingTransactedConsumption]] Enabling Transacted Consumption ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A common requirement is to consume from a queue in a transaction and then process the message using the Camel route. To do this, just ensure that you set the following properties on the component/endpoint: * `transacted` = true * `transactionManager` = a _Transsaction Manager_ - typically the `JmsTransactionManager` See the link:transactional-client.html[Transactional Client] EIP pattern for further details. Transactions and [Request Reply] over JMS When using link:request-reply.html[Request Reply] over JMS you cannot use a single transaction; JMS will not send any messages until a commit is performed, so the server side won't receive anything at all until the transaction commits. Therefore to use link:request-reply.html[Request Reply] you must commit a transaction after sending the request and then use a separate transaction for receiving the response. To address this issue the JMS component uses different properties to specify transaction use for oneway messaging and request reply messaging: The `transacted` property applies *only* to the InOnly message link:exchange-pattern.html[Exchange Pattern] (MEP). The `transactedInOut` property applies to the InOut(link:request-reply.html[Request Reply]) message link:exchange-pattern.html[Exchange Pattern] (MEP). If you want to use transactions for link:request-reply.html[Request Reply](InOut MEP), you *must* set `transactedInOut=true`. *Available as of Camel 2.10* You can leverage the http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.html#setSessionTransacted(boolean)[DMLC transacted session API] using the following properties on component/endpoint: * `transacted` = true * `lazyCreateTransactionManager` = false The benefit of doing so is that the cacheLevel setting will be honored when using local transactions without a configured TransactionManager. When a TransactionManager is configured, no caching happens at DMLC level and its necessary to rely on a pooled connection factory. For more details about this kind of setup see http://tmielke.blogspot.com/2012/03/camel-jms-with-transactions-lessons.html[here] and http://forum.springsource.org/showthread.php?123631-JMS-DMLC-not-caching%20connection-when-using-TX-despite-cacheLevel-CACHE_CONSUMER&p=403530&posted=1#post403530[here]. [[JMS-UsingJMSReplyToforlatereplies]] Using JMSReplyTo for late replies ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When using Camel as a JMS listener, it sets an Exchange property with the value of the ReplyTo `javax.jms.Destination` object, having the key `ReplyTo`. You can obtain this `Destination` as follows: [source,java] ----------------------------------------------------------------------------------------------------------------- Destination replyDestination = exchange.getIn().getHeader(JmsConstants.JMS_REPLY_DESTINATION, Destination.class); ----------------------------------------------------------------------------------------------------------------- And then later use it to send a reply using regular JMS or Camel. [source,java] ---------------------------------------------------------------------------------------- // we need to pass in the JMS component, and in this sample we use ActiveMQ JmsEndpoint endpoint = JmsEndpoint.newInstance(replyDestination, activeMQComponent); // now we have the endpoint we can use regular Camel API to send a message to it template.sendBody(endpoint, "Here is the late reply."); ---------------------------------------------------------------------------------------- A different solution to sending a reply is to provide the `replyDestination` object in the same Exchange property when sending. Camel will then pick up this property and use it for the real destination. The endpoint URI must include a dummy destination, however. For example: [source,java] ---------------------------------------------------------------------------------------------------------------------------------------- // we pretend to send it to some non existing dummy queue template.send("activemq:queue:dummy, new Processor() { public void process(Exchange exchange) throws Exception { // and here we override the destination with the ReplyTo destination object so the message is sent to there instead of dummy exchange.getIn().setHeader(JmsConstants.JMS_DESTINATION, replyDestination); exchange.getIn().setBody("Here is the late reply."); } } ---------------------------------------------------------------------------------------------------------------------------------------- [[JMS-Usingarequesttimeout]] Using a request timeout ^^^^^^^^^^^^^^^^^^^^^^^ In the sample below we send a link:request-reply.html[Request Reply] style message link:exchange.html[Exchange] (we use the `requestBody` method = `InOut`) to the slow queue for further processing in Camel and we wait for a return reply: [[JMS-Samples]] Samples ^^^^^^^ JMS is used in many examples for other components as well. But we provide a few samples below to get started. [[JMS-ReceivingfromJMS]] Receiving from JMS ++++++++++++++++++ In the following sample we configure a route that receives JMS messages and routes the message to a POJO: [source,java] -------------------------------- from("jms:queue:foo"). to("bean:myBusinessLogic"); -------------------------------- You can of course use any of the EIP patterns so the route can be context based. For example, here's how to filter an order topic for the big spenders: [source,java] ---------------------------------------------- from("jms:topic:OrdersTopic"). filter().method("myBean", "isGoldCustomer"). to("jms:queue:BigSpendersQueue"); ---------------------------------------------- [[JMS-SendingtoJMS]] Sending to JMS ++++++++++++++ In the sample below we poll a file folder and send the file content to a JMS topic. As we want the content of the file as a `TextMessage` instead of a `BytesMessage`, we need to convert the body to a `String`: [source,java] ------------------------------ from("file://orders"). convertBodyTo(String.class). to("jms:topic:OrdersTopic"); ------------------------------ [[JMS-UsingAnnotations]] Using link:bean-integration.html[Annotations] +++++++++++++++++++++++++++++++++++++++++++++ Camel also has annotations so you can use link:pojo-consuming.html[POJO Consuming] and link:pojo-producing.html[POJO Producing]. [[JMS-SpringDSLsample]] Spring DSL sample +++++++++++++++++ The preceding examples use the Java DSL. Camel also supports Spring XML DSL. Here is the big spender sample using Spring DSL: [source,xml] --------------------------------------------------- --------------------------------------------------- [[JMS-Othersamples]] Other samples +++++++++++++ JMS appears in many of the examples for other components and EIP patterns, as well in this Camel documentation. So feel free to browse the documentation. If you have time, check out the this tutorial that uses JMS but focuses on how well Spring Remoting and Camel works together link:tutorial-jmsremoting.html[Tutorial-JmsRemoting]. [[JMS-UsingJMSasaDeadLetterQueuestoringExchange]] Using JMS as a Dead Letter Queue storing Exchange +++++++++++++++++++++++++++++++++++++++++++++++++ Normally, when using link:jms.html[JMS] as the transport, it only transfers the body and headers as the payload. If you want to use link:jms.html[JMS] with a link:dead-letter-channel.html[Dead Letter Channel], using a JMS queue as the Dead Letter Queue, then normally the caused Exception is not stored in the JMS message. You can, however, use the `transferExchange` option on the JMS dead letter queue to instruct Camel to store the entire link:exchange.html[Exchange] in the queue as a `javax.jms.ObjectMessage` that holds a `org.apache.camel.impl.DefaultExchangeHolder`. This allows you to consume from the Dead Letter Queue and retrieve the caused exception from the Exchange property with the key `Exchange.EXCEPTION_CAUGHT`. The demo below illustrates this: [source,java] ------------------------------------------------------------------------ // setup error handler to use JMS as queue and store the entire Exchange errorHandler(deadLetterChannel("jms:queue:dead?transferExchange=true")); ------------------------------------------------------------------------ Then you can consume from the JMS queue and analyze the problem: [source,java] ----------------------------------------------------------------------------------- from("jms:queue:dead").to("bean:myErrorAnalyzer"); // and in our bean String body = exchange.getIn().getBody(); Exception cause = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Exception.class); // the cause message is String problem = cause.getMessage(); ----------------------------------------------------------------------------------- [[JMS-UsingJMSasaDeadLetterChannelstoringerroronly]] Using JMS as a Dead Letter Channel storing error only +++++++++++++++++++++++++++++++++++++++++++++++++++++ You can use JMS to store the cause error message or to store a custom body, which you can initialize yourself. The following example uses the link:message-translator.html[Message Translator] EIP to do a transformation on the failed exchange before it is moved to the link:jms.html[JMS] dead letter queue: [source,java] -------------------------------------------------------------------------------------------------- // we sent it to a seda dead queue first errorHandler(deadLetterChannel("seda:dead")); // and on the seda dead queue we can do the custom transformation before its sent to the JMS queue from("seda:dead").transform(exceptionMessage()).to("jms:queue:dead"); -------------------------------------------------------------------------------------------------- Here we only store the original cause error message in the transform. You can, however, use any link:expression.html[Expression] to send whatever you like. For example, you can invoke a method on a Bean or use a custom processor. [[JMS-SendinganInOnlymessageandkeepingtheJMSReplyToheader]] Sending an InOnly message and keeping the JMSReplyTo header ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ When sending to a link:jms.html[JMS] destination using *camel-jms* the producer will use the MEP to detect if its _InOnly_ or _InOut_ messaging. However there can be times where you want to send an _InOnly_ message but keeping the `JMSReplyTo` header. To do so you have to instruct Camel to keep it, otherwise the `JMSReplyTo` header will be dropped. For example to send an _InOnly_ message to the foo queue, but with a `JMSReplyTo` with bar queue you can do as follows: [source,java] ------------------------------------------------------------------------------------- template.send("activemq:queue:foo?preserveMessageQos=true", new Processor() { public void process(Exchange exchange) throws Exception { exchange.getIn().setBody("World"); exchange.getIn().setHeader("JMSReplyTo", "bar"); } }); ------------------------------------------------------------------------------------- Notice we use `preserveMessageQos=true` to instruct Camel to keep the `JMSReplyTo` header. [[JMS-SettingJMSprovideroptionsonthedestination]] Setting JMS provider options on the destination ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some JMS providers, like IBM's WebSphere MQ need options to be set on the JMS destination. For example, you may need to specify the `targetClient` option. Since `targetClient` is a WebSphere MQ option and not a Camel URI option, you need to set that on the JMS destination name like so: [source,java] ----------------------------------------------------------------------------------- // ... .setHeader("CamelJmsDestinationName", constant("queue:///MY_QUEUE?targetClient=1")) .to("wmq:queue:MY_QUEUE?useMessageIDAsCorrelationID=true"); ----------------------------------------------------------------------------------- Some versions of WMQ won't accept this option on the destination name and you will get an exception like: [source] ---------------------------------------------------------------------------------------------------------------------------------- com.ibm.msg.client.jms.DetailedJMSException: JMSCC0005: The specified value 'MY_QUEUE?targetClient=1' is not allowed for 'XMSC_DESTINATION_NAME' ---------------------------------------------------------------------------------------------------------------------------------- A workaround is to use a custom DestinationResolver: [source,java] ---------------------------------------------------------------------------------------------------------------------------------- JmsComponent wmq = new JmsComponent(connectionFactory); wmq.setDestinationResolver(new DestinationResolver() { public Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain) throws JMSException { MQQueueSession wmqSession = (MQQueueSession) session; return wmqSession.createQueue("queue:///" + destinationName + "?targetClient=1"); } }); ---------------------------------------------------------------------------------------------------------------------------------- [[JMS-SeeAlso]] See Also ^^^^^^^^ * link:configuring-camel.html[Configuring Camel] * link:component.html[Component] * link:endpoint.html[Endpoint] * link:getting-started.html[Getting Started] * link:transactional-client.html[Transactional Client] * link:bean-integration.html[Bean Integration] * link:tutorial-jmsremoting.html[Tutorial-JmsRemoting] * http://activemq.apache.org/jmstemplate-gotchas.html[JMSTemplate gotchas]