Shared Subscription: 1 Adress -> 2 Topic with multicast : 2 MDB

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Shared Subscription: 1 Adress -> 2 Topic with multicast : 2 MDB

Thank you 123
Hi

My requirement is to send the the message to one of the 2 MDB's created, of
which both are subscribed to the same topic.
 MDB1:
@MessageDriven(name = "TOPICMDB1", activationConfig =
        { @ActivationConfigProperty(propertyName = "destinationType", propertyValue
= "javax.jms.Topic"),
                @ActivationConfigProperty(propertyName = "destination", propertyValue =
"ATOPIC"),
                @ActivationConfigProperty(propertyName = "maxSession", propertyValue =
"5"),
                @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue
= "Auto-acknowledge"),
            @ActivationConfigProperty(propertyName = "subscriptionName",
propertyValue = "mytopic"),
            @ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "durable"),
            @ActivationConfigProperty(propertyName = "shareSubscriptions",
propertyValue="true"),
            @ActivationConfigProperty(propertyName = "clientId", propertyValue =
"MyClientId_1")
       
        })


        public class TopicListener1 implements MessageListener,
java.io.Serializable

MDB2:

@MessageDriven(name = "TOPICMDB2", activationConfig =
{ @ActivationConfigProperty(propertyName = "destinationType", propertyValue
= "javax.jms.Topic"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue =
"ATOPIC"),
        @ActivationConfigProperty(propertyName = "maxSession", propertyValue =
"5"),
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue =
"Auto-acknowledge"),
@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue =
"mytopic"),
@ActivationConfigProperty(propertyName = "subscriptionDurability",
propertyValue = "durable"),
@ActivationConfigProperty(propertyName = "shareSubscriptions",
propertyValue="true"),
@ActivationConfigProperty(propertyName = "clientId", propertyValue =
"MyClientId_1")
})

public class TopicListener2 implements MessageListener, java.io.Serializable

tomee.xml:

  <Resource id="ATOPIC"
                          class-name="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
                          constructor="name"
                          factory-name="createTopic"
                          type="javax.jms.Topic">
        name=ATOPIC
        </Resource>
mybroker.xml:

     <address name = "ATOPIC">
                    <multicast>
                                                   <queue name = "ATOPIC"/>
                                              </multicast>
               </address>

My Question: 1Q: With the above code the message is going to both topics.
But i want them to be sent only to a single topic as per the guidelines of
shared subscription.
2Q: there are many long valued or numbers queues being created in the
artemis console. how to stop them from getting created ? why do they get
created ?

Please help.
Thank you








--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
Reply | Threaded
Open this post in threaded view
|

Re: Shared Subscription: 1 Adress -> 2 Topic with multicast : 2 MDB

jbertram
For the record, I've been trying to help this user over on Stack Overflow
[1].


Justin

[1]
https://stackoverflow.com/questions/60833450/activemq-artemis-2-10-1-jms-2-0-shared-subscription-not-working

On Mon, Mar 23, 2020 at 12:03 PM mailtejasvi <[hidden email]> wrote:

> Hi
>
> My requirement is to send the the message to one of the 2 MDB's created, of
> which both are subscribed to the same topic.
>  MDB1:
> @MessageDriven(name = "TOPICMDB1", activationConfig =
>         { @ActivationConfigProperty(propertyName = "destinationType",
> propertyValue
> = "javax.jms.Topic"),
>                 @ActivationConfigProperty(propertyName = "destination",
> propertyValue =
> "ATOPIC"),
>                 @ActivationConfigProperty(propertyName = "maxSession",
> propertyValue =
> "5"),
>                 @ActivationConfigProperty(propertyName =
> "acknowledgeMode", propertyValue
> = "Auto-acknowledge"),
>             @ActivationConfigProperty(propertyName = "subscriptionName",
> propertyValue = "mytopic"),
>             @ActivationConfigProperty(propertyName =
> "subscriptionDurability",
> propertyValue = "durable"),
>             @ActivationConfigProperty(propertyName = "shareSubscriptions",
> propertyValue="true"),
>             @ActivationConfigProperty(propertyName = "clientId",
> propertyValue =
> "MyClientId_1")
>
>         })
>
>
>         public class TopicListener1 implements MessageListener,
> java.io.Serializable
>
> MDB2:
>
> @MessageDriven(name = "TOPICMDB2", activationConfig =
> { @ActivationConfigProperty(propertyName = "destinationType", propertyValue
> = "javax.jms.Topic"),
>         @ActivationConfigProperty(propertyName = "destination",
> propertyValue =
> "ATOPIC"),
>         @ActivationConfigProperty(propertyName = "maxSession",
> propertyValue =
> "5"),
>         @ActivationConfigProperty(propertyName = "acknowledgeMode",
> propertyValue =
> "Auto-acknowledge"),
> @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue
> =
> "mytopic"),
> @ActivationConfigProperty(propertyName = "subscriptionDurability",
> propertyValue = "durable"),
> @ActivationConfigProperty(propertyName = "shareSubscriptions",
> propertyValue="true"),
> @ActivationConfigProperty(propertyName = "clientId", propertyValue =
> "MyClientId_1")
> })
>
> public class TopicListener2 implements MessageListener,
> java.io.Serializable
>
> tomee.xml:
>
>   <Resource id="ATOPIC"
>
> class-name="org.apache.activemq.artemis.api.jms.ActiveMQJMSClient"
>                           constructor="name"
>                           factory-name="createTopic"
>                           type="javax.jms.Topic">
>         name=ATOPIC
>         </Resource>
> mybroker.xml:
>
>      <address name = "ATOPIC">
>                     <multicast>
>                                                    <queue name = "ATOPIC"/>
>                                               </multicast>
>                </address>
>
> My Question: 1Q: With the above code the message is going to both topics.
> But i want them to be sent only to a single topic as per the guidelines of
> shared subscription.
> 2Q: there are many long valued or numbers queues being created in the
> artemis console. how to stop them from getting created ? why do they get
> created ?
>
> Please help.
> Thank you
>
>
>
>
>
>
>
>
> --
> Sent from:
> http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html
>
>