---
schema_version: "1"
id: 586e1e3cac5ecdfa9b44dadbbb280d38f49b90f7046936954cfa7045527ff43f
title: Configure Topic Subscriptions with JMS Connector
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/jms-connector/1.10/jms-topic-subscription.md
canonical_url: https://docs.mulesoft.com/jms-connector/1.10/jms-topic-subscription
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 3b7ca025d9302c548e75a0746f4b53197da4c77fe13172db10796ffaa834fcde
description: MuleSoft Documentation Site
release: "1.10"
latest: false
---
---
product: JMS Connector
version: 1.10
keywords: jms, connector, consume, source, listener, topic, subscription
---

# Configure Topic Subscriptions with JMS Connector

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Topic subscriptions in JMS enable you to configure how the subscription behaves regarding the
connection of consumers and how consumers interact.

The Anypoint Connector for JMS (JMS Connector) **Consumer** and **On New Message** operations manage
topic subscriptions in the **Consumer type** field by selecting the **Topic consumer**
configuration.

## Configure Durable Subscriptions

Durable subscriptions enable you to receive messages published to the topic while the consumer is
offline. The JMS provider stores messages sent or published to a topic, just as it would store
messages sent to a queue. If another application has a **Topic consumer** configuration that uses
the same connection, client ID, topic, and subscription name, the subscription reactivates, and the
JMS provider delivers the published messages while the subscriber was inactive.

In the following example, you **Topic consumer** to **Durable**:

1.  In Studio, select the **Consume** operation from your flow.

2.  Set the **Destination** field to `#[vars.destination]`.

3.  Set the **Consumer type** field to **Topic consumer**.

4.  Select the **Durable** option.

5.  Set the **Subscription name** to `SampleSub`.

![In the Consume operation screen](/mulesoft/current/en-us/jms-connector/1.10/_images/jms-topic-durable.png)

Figure 1. JMS Connector Topic Consumer Durable configuration

In the XML editor, the `<jms:topic-consumer>` and `durable` configurations look like this:

```xml
<jms:consume config-ref="JMS_config" destination="#[vars.destination]">
    <jms:consumer-type>
        <jms:topic-consumer durable="true" subscriptionName="SampleSub"/>
    </jms:consumer-type>
</jms:consume>
```

## Configure Shared Subscriptions

In a JMS spec 1.1 connection, a subscription to a topic cannot have more than one consumer at a
time, meaning that the processing work of messages on a topic subscription cannot be shared, thereby
limiting the scalability of the application. The JMS spec 2.0 connection removes this restriction
and enables you to configure shared consumers on the same subscription.

In the following example, you set **Topic consumer** to **Shared**:

1.  In Studio, select the **Consume** operation from your flow.

2.  Set the **Destination** field to `InvoiceEventsTopic`.

3.  Set the **Consumer type** field to **Topic consumer**:

4.  Select the **Shared** option.

5.  Set the **Subscription name** to `ClusterSubscription`.

![In the Consume operation screen](/mulesoft/current/en-us/jms-connector/1.10/_images/jms-topic-shared.png)

Figure 2. JMS Connector Topic Consumer Shared configuration

In the XML editor, the `<jms:topic-consumer>` and `shared` configurations look like this:

```xml
<jms:listener config-ref="config" destination="InvoiceEventsTopic">
    <jms:consumer-type>
        <jms:topic-consumer shared="true" subscriptionName="ClusterSubscription"/>
    </jms:consumer-type>
</jms:listener>
```

## Configure No Local Subscriptions

There are cases in which you may not want to receive published messages to a topic by the same
application. To prevent the consumer to receive published messages to a topic by the same
connection, configure the **Topic consumer** field to **No local**. Consumers configured as no local
can not be part of a shared subscription.

In the following example, you set **Topic consumer** to **No local** :

1.  In Studio, select the **Consume** operation from your flow.

2.  Set the **Destination** field to `{notificationsChannel}`.

3.  Set the **Consumer type** field to **Topic consumer**:

4.  Select the **No local** option.

![In the Consume operation screen](/mulesoft/current/en-us/jms-connector/1.10/_images/jms-topic-nolocal.png)

Figure 3. JMS Connector Topic Consumer No local configuration

In the XML editor, the `<jms:topic-consumer>` and `noLocal` configurations look like this:

```xml
<jms:listener config-ref="config" destination="${notificationsChannel}">
    <jms:consumer-type>
        <jms:topic-consumer noLocal="true"/>
    </jms:consumer-type>
</jms:listener>
```

## See Also

- [Listen for New Messages](https://docs.mulesoft.com/jms-connector/1.10/jms-listener)

- [Consume Messages](https://docs.mulesoft.com/jms-connector/1.10/jms-consume)
