// Do not edit directly!
// This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
[id="extensions-jms"]
= JMS
:page-aliases: extensions/jms.adoc
:linkattrs:
:cq-artifact-id: camel-quarkus-jms
:cq-native-supported: true
:cq-status: Stable
:cq-status-deprecation: Stable
:cq-description: Sent and receive messages to/from a JMS Queue or Topic.
:cq-deprecated: false
:cq-jvm-since: 1.0.0
:cq-native-since: 1.0.0

ifeval::[{doc-show-badges} == true]
[.badges]
[.badge-key]##JVM since##[.badge-supported]##1.0.0## [.badge-key]##Native since##[.badge-supported]##1.0.0##
endif::[]

Sent and receive messages to/from a JMS Queue or Topic.

[id="extensions-jms-whats-inside"]
== What's inside

* xref:{cq-camel-components}::jms-component.adoc[JMS component], URI syntax: `jms:destinationType:destinationName`

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

[id="extensions-jms-maven-coordinates"]
== Maven coordinates

https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-jms[Create a new project with this extension on {link-quarkus-code-generator}, window="_blank"]

Or add the coordinates to your existing project:

[source,xml]
----
<dependency>
    <groupId>org.apache.camel.quarkus</groupId>
    <artifactId>camel-quarkus-jms</artifactId>
</dependency>
----
ifeval::[{doc-show-user-guide-link} == true]
Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.
endif::[]

[id="extensions-jms-usage"]
== Usage
[id="extensions-jms-usage-message-mapping-with-org-w3c-dom-node"]
=== Message mapping with `org.w3c.dom.Node`

The Camel JMS component supports message mapping between `javax.jms.Message` and `org.apache.camel.Message`. When wanting to convert a Camel message body type of `org.w3c.dom.Node`, 
you must ensure that the `camel-quarkus-xml-jaxp` extension is present on the classpath.

[id="extensions-jms-usage-native-mode-support-for-javax-jms-objectmessage"]
=== Native mode support for javax.jms.ObjectMessage

When sending JMS message payloads as `javax.jms.ObjectMessage`, you must annotate the relevant classes to be registered for serialization with `@RegisterForReflection(serialization = true)`. 
Note that this extension automatically sets `quarkus.camel.native.reflection.serialization-enabled = true` for you. Refer to the xref:user-guide/native-mode.adoc#serialization[native mode user guide] for more information.

[id="extensions-jms-usage-support-for-connection-pooling-and-x-open-xa-distributed-transactions"]
=== Support for Connection pooling and X/Open XA distributed transactions
ifeval::[{doc-show-extra-content} == true]

[NOTE]
====
Connection pooling is a Technical Preview feature in this release of {project-name}.

To use connection pooling in the `camel-quarkus-jms` components, you must add `io.quarkiverse.artemis:quarkus-artemis` and `io.quarkiverse.messaginghub:quarkus-pooled-jms` to your pom.xml and set the following configuration:
----
quarkus.pooled-jms.max-connections = 8
----
====

endif::[]

You can use the `quarkus-pooled-jms` extension to get pooling and XA support for JMS connections. Refer to the https://quarkiverse.github.io/quarkiverse-docs/quarkus-pooled-jms/dev/index.html[quarkus-pooled-jms] extension documentation for more information.
Currently, it only works with `quarkus-artemis-jms` extension. Just add these two dependencies to your `pom.xml`:
[source,xml]
----
<dependency>
    <groupId>io.quarkiverse.messaginghub</groupId>
    <artifactId>quarkus-pooled-jms</artifactId>
</dependency>
<dependency>
    <groupId>io.quarkiverse.artemis</groupId>
    <artifactId>quarkus-artemis-jms</artifactId>
</dependency>
----

Note that pooling is enabled by default.

To enable XA, you need to add the following configuration to your `application.properties`:
[source,properties]
----
quarkus.pooled-jms.xa.enabled=true
----

[NOTE]
====
`clientID` and `durableSubscriptionName` are not supported in pooling connections. If `setClientID` is called on a `reused` connection from the pool, an `IllegalStateException` will be thrown. You will get some error messages such like `Cause: setClientID can only be called directly after the connection is created`
====


[id="extensions-jms-transferexception-option-in-native-mode"]
== transferException option in native mode

To use the `transferException` option in native mode, you must enable support for object serialization. Refer to the xref:user-guide/native-mode.adoc#serialization[native mode user guide]
for more information.

You will also need to enable serialization for the exception classes that you intend to serialize. For example.
[source,java]
----
@RegisterForReflection(targets = { IllegalStateException.class, MyCustomException.class }, serialization = true)
----
