> For the complete documentation index, see [llms.txt](https://docs.xplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.xplatform.com/talon/developing-applications/configuring-messaging/configuring-bus-connections/jms-binding.md).

# JMS Binding

Configuration reference for the JMS message bus binding.

## Overview

The JMS binding works with JMS 1.1 level JMS clients and is configured using JNDI lookup. The platform also provides provider-specific implementations optimized for ActiveMQ and Tibco EMS.

For conceptual information about the JMS binding, see [JMS Binding](/talon/concepts-and-architecture/messaging-model/jms-binding.md).

## Bus Descriptor Format

JMS buses can be configured using a descriptor string or decomposed DDL format.

### Descriptor String

```
jms://<address>:<port>&prop1=val1&propN=valN
```

**Example** (Tibco EMS):

```
jms://tibcohost:2732&username=admin&password=changeme&jndi=true&jndi_contextfactory=com.tibco.tibjms.naming.TibjmsInitialContextFactory&jndi_principal=admin&jndi_credentials=changme&jndi_connectionfactory=CSTopicConnectionFactory
```

### Decomposed DDL Format

```xml
<buses>
  <bus name="my-bus">
    <provider>jms</provider>
    <address>192.168.1.9</address>
    <port>55555</port>
    <properties>
      <username>admin</username>
      <password>changeme</password>
      <jndi>true</jndi>
      <jndi_contextfactory>com.tibco.tibjms.naming.TibjmsInitialContextFactory</jndi_contextfactory>
      <jndi_principal>admin</jndi_principal>
      <jndi_credentials>changme</jndi_credentials>
      <jndi_connectionfactory>CSTopicConnectionFactory</jndi_connectionfactory>
    </properties>
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

### As Descriptor (Substitution Support)

```xml
<buses>
  <bus name="my-bus" descriptor="jms://${jms.host}:${jms.port}&username=${jms.user}&password=${jms.password}&jndi=true&jndi_contextfactory=${jms.contextfactory}&jndi_principal=${jms.principal}&jndi_credentials=${jms.credentials}&jndi_connectionfactory=${jms.connectionfactory}">
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

The descriptor form is useful when the descriptor is supplied as an external configuration property:

```xml
<buses>
  <bus name="my-bus" descriptor="${myBusDescriptor::loopback://mybus}">
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

## Generic JMS Binding Properties

The following properties can be set in the descriptor used to create a JMS bus binding.

| Property                         | Default | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `jndi`                           | true    | <p>Indicates that JNDI should be used to lookup the connection factory for creating JMS connections.<br><br></p><div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p><br>When using JNDI, the address portion of the binding descriptor is used as the address at which to lookup the connection factory. The returned connection factory may connect to a different host.<br></p></div>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `jndi_contextfactory`            | -       | The name of the environment property for specifying the initial context factory to use.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `jndi_principal`                 | -       | The name of the environment property for specifying the identity of the principal for authenticating the caller to the service.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `jndi_credentials`               | -       | The environment property for specifying the credentials of the principal for authenticating the caller to the service.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `jndi_connectionfactory`         | -       | The name of the connection factory to look up in JNDI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `username`                       | -       | The username to supply in the credentials when opening the JMS connection.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `password`                       | -       | The password to supply in the credentials when opening the JMS connection.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `set_client_id`                  | true    | <p>Specifies whether a client\_id should be set for the connection.<br><br>When true, <code>Connection.setClientID(String)</code> is set on the JMS connection. It is important that the client id be set when using <code>Guaranteed</code> QoS subscriptions as the durable subscriptions issued by the binding are tied to the ClientID.<br><br>When set to true, the client id <code>X-SMA-\<busname>-\<bususer></code> will be used as the JMS ClientID unless <code>use\_legacy\_client\_id</code> or <code>client\_id</code> are set.<br><br>Note that the bususer value used in the ClientID is the username supplied during bus creation to identify the logical bus user, not the <code>username</code> used in the credentials for connecting to the JMS broker.<br><br></p><div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p><br>If the JMS connection is created from a JNDI connection factory that provides a pre-configured JMS ClientID, it may cause the JMS provider to throw an exception when the client id is set. Consequently, this value should be set to false if the connection factory is supplying the client id.<br></p></div><p><br></p><div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p><br><strong>Breaking Change (3.8)</strong>: Prior to the 3.8 release the ActiveMQ specific provider set a client id of <code>\<username>\<busname></code>. The change to <code>X-SMA-\<busname>-\<bususer></code> is a breaking change for applications that have existing durable subscriptions associated with the old Client ID. The property <code>use\_legacy\_client\_id=true</code> can be set to use the old client id.<br></p></div> |
| `use_legacy_client_id`           | false   | <p>Specifies that the legacy client id should be used.<br><br>When set to true indicates that the default client id of <code>\<bususer>-\<busname></code> should be used rather than the default <code>X-SMA-\<busname>-\<bususer></code>.<br><br>This property is ignored if <code>set\_client\_id</code> is <code>false</code> or <code>client\_id</code> is used to set an explicit JMS ClientID. This property should only be set for applications that were using the activemq bus provider in 3.7 or earlier.<br><br><strong>Since 3.8</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `client_id`                      | -       | <p>Can be used to specify a specific client id for the bus.<br><br>This property can be used to override the default client id when <code>set\_client\_id</code> is set to true.<br><br></p><div data-gb-custom-block data-tag="hint" data-style="warning" class="hint hint-warning"><p><br>Note that if the bus is shared between multiple applications, the client id should be different for each application, but the same for primary and backup instances.<br></p></div><p><br><br><strong>Since 3.8</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `connection_open_retry_count`    | 10      | <p>Property controlling number of retries to attempt after a failure to open a connection.<br><br>When a connection attempt fails with a reason that isn't known to be a permanent condition, this property controls the number of reconnect attempts to try. Reconnect attempts will be attempted at the interval specified by <code>connection\_open\_retry\_interval</code>.<br><br><strong>Since 3.8</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `connection_open_retry_interval` | 1s      | <p>Property specifying the retry interval for connection open retries in seconds.<br><br>When no time unit suffix is provided for this value it is interpreted as the number of seconds between retries. Otherwise, a time suffix can be provided to qualify the unit as specified in <a href="https://build.neeveresearch.com/core/javadoc/LATEST/com/neeve/util/UtlUnit.html#parseDuration(java.lang.String,%20java.util.concurrent.TimeUnit,%20java.util.concurrent.TimeUnit)"><code>UtlUnit.parseDuration(String, TimeUnit, TimeUnit)</code></a>.<br><br>The minimum allowable value for retries is 250ms, specifying a lower value will cause it to be rounded up.<br><br><strong>Since 3.8</strong></p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## Provider Specific Implementations

### ActiveMQ

While ActiveMQ can be configured via JNDI like any other JMS provider, the platform provides a custom `activemq` bus provider.

The ActiveMQ binding is additionally optimized to:

* Use ActiveMQ's `INDIVIDUAL_ACKNOWLEDGE_MODE` for channels using Guaranteed delivery
* Normalize subscribe and send calls to replace `/` delimited topics with `.` delimited topics which allows the same channel key configuration as other platform bindings

#### Decomposed DDL Format

```xml
<buses>
  <bus name="my-bus">
    <provider>activemq</provider>
    <address>192.168.1.9</address>
    <port>66666</port>
    <properties>
    </properties>
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

#### As Descriptor

```xml
<buses>
  <bus name="my-bus" descriptor="activemq://192.168.1.9:66666">
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

#### Binding Specific Properties

The ActiveMQ binding does not have any binding-specific properties beyond the [Generic JMS Binding Properties](#generic-jms-binding-properties) listed above.

### Tibco EMS

**Since 3.8**

While Tibco EMS can be configured via JNDI like any other JMS provider, the platform provides a custom `tibems` bus provider.

The Tibco EMS binding is additionally optimized to:

* Use Tibco EMS' `EXPLICIT_CLIENT_ACKNOWLEDGE` for channels using Guaranteed delivery
* Normalize subscribe and send calls to replace `/` delimited topics with `.` delimited topics which allows the same channel key configuration as other platform bindings

#### Decomposed DDL Format

```xml
<buses>
  <bus name="my-bus">
    <provider>tibems</provider>
    <address>192.168.1.9</address>
    <port>7222</port>
    <properties>
    </properties>
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

#### As Descriptor

```xml
<buses>
  <bus name="my-bus" descriptor="tibems://192.168.1.9:7222">
    <channels>
      <!-- channel configuration -->
    </channels>
  </bus>
</buses>
```

#### Binding Specific Properties

The Tibco EMS binding does not have any binding-specific properties beyond the [Generic JMS Binding Properties](#generic-jms-binding-properties) listed above.

## See Also

* [JMS Binding](/talon/concepts-and-architecture/messaging-model/jms-binding.md) - Conceptual overview
* [Configuring Bus Connections](/talon/developing-applications/configuring-messaging/configuring-bus-connections.md) - General bus configuration
