I am using qpid JMS api and Java Broker. Below source code should explain
what I am trying to do here .

I have two topic subscriber on a Topic . After publishing a message on
topic , I should be able to receive message from both of subscription .

But I am receiving message for only first subscription .

-------------------------------------------------------------------------------------------------------
            javax.jms.Topic topic = sess.createTopic("queue");

             conn.start();



             javax.jms.MessageProducer prod = sess.createProducer(topic);
             javax.jms.TopicSubscriber consumer =
sess.createDurableSubscriber(topic, "hello1");
             javax.jms.TopicSubscriber consumer1 =
sess.createDurableSubscriber(topic, "hello");



             javax.jms.TextMessage msg = sess.createTextMessage();

             msg.setText("hello");

              ((MessageProducerImpl)prod).publish(msg);

             javax.jms.TextMessage msg1 =
(javax.jms.TextMessage)consumer.receive();


             System.out.println("done : "+msg1.getText());

             javax.jms.TextMessage msg2 =
(javax.jms.TextMessage)consumer1.receive(5);


             System.out.println("done : "+msg2.getText()); // this returns
null

 
----------------------------------------------------------------------------------------------------------------------------------


 I believe creating JMS subscription is mapped to the creating receiving
link with target terminus distribution Mode as 'COPY' in AMQP , so I should
receive the message for both of subscription.

I have another question , if we are specifying target with distribution
Mode as 'COPY' while creating receiving link , then how message will be
expired from the Distribution Node as per AMQP protocol. (let me know if I
am not clear)

 Regards,
Rakesh

Reply via email to