You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Rakesh Kushwaha <ku...@gmail.com> on 2013/05/07 10:17:38 UTC

Re: Topic subscription for JMS api probably not working

waiting for reply !!!


On Fri, Apr 26, 2013 at 4:05 PM, Rakesh Kushwaha <ku...@gmail.com>wrote:

> 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
>

Re: Topic subscription for JMS api probably not working

Posted by Rob Godfrey <ro...@gmail.com>.
On 9 May 2013 14:50, Rakesh Kushwaha <ku...@gmail.com> wrote:

> My question was with respect to AMQP 1.0 compliance qpid Broker and AMQP
> 1.0 JMS java client .
>


AMQP 1.0 doesn't define how message will be expired... It only defines the
two distribution policies.

An implementation providing topic like behaviour may implement a ring
policy, a time based policy, or a reachability policy (i.e. all current
consumers have seen this message so it can now be discarded).  Definition
of such policies may form an extension to the specification, but it not
currently standardised.  If you want topic like behaviour right now you
need to use a topic exchange for your topic.

Using an exchange as the node essentially creates a reachability policy.

-- Rob


>
>
> On Thu, May 9, 2013 at 4:45 PM, Rob Godfrey <ro...@gmail.com>
> wrote:
>
> > Hi Rakesh,
> >
> > apologies - I've been rather busy over the last couple of weeks...
> >
> > I'll try to look at the issue with the Java Client / Broker today.
> >
> >
> > > >
> > > > 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)
> > >
> >
> > In answer to your question, how messages get expired is really a property
> > of the node.  Currently the implementation of queues in the Java Broker
> has
> > no way of making them behave as topics.
> >
> > If you want to use topics with the Java broker, the way to do so right
> now
> > would be to create a topic exchange for each topic that you wish to
> > create.  Then use the name of the exchange as the name of the topic.
>  under
> > the covers the Java Broker will create a temporary queue for each
> > subscription, much as AMQP 0.8/9/10 do.
> >
> > -- Rob
> >
> >
> > > >
> > > >  Regards,
> > > > Rakesh
> > > >
> > >
> >
>

Re: Topic subscription for JMS api probably not working

Posted by Rakesh Kushwaha <ku...@gmail.com>.
My question was with respect to AMQP 1.0 compliance qpid Broker and AMQP
1.0 JMS java client .


On Thu, May 9, 2013 at 4:45 PM, Rob Godfrey <ro...@gmail.com> wrote:

> Hi Rakesh,
>
> apologies - I've been rather busy over the last couple of weeks...
>
> I'll try to look at the issue with the Java Client / Broker today.
>
>
> > >
> > > 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)
> >
>
> In answer to your question, how messages get expired is really a property
> of the node.  Currently the implementation of queues in the Java Broker has
> no way of making them behave as topics.
>
> If you want to use topics with the Java broker, the way to do so right now
> would be to create a topic exchange for each topic that you wish to
> create.  Then use the name of the exchange as the name of the topic.  under
> the covers the Java Broker will create a temporary queue for each
> subscription, much as AMQP 0.8/9/10 do.
>
> -- Rob
>
>
> > >
> > >  Regards,
> > > Rakesh
> > >
> >
>

Re: Topic subscription for JMS api probably not working

Posted by Rob Godfrey <ro...@gmail.com>.
Hi Rakesh,

apologies - I've been rather busy over the last couple of weeks...

I'll try to look at the issue with the Java Client / Broker today.


> >
> > 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)
>

In answer to your question, how messages get expired is really a property
of the node.  Currently the implementation of queues in the Java Broker has
no way of making them behave as topics.

If you want to use topics with the Java broker, the way to do so right now
would be to create a topic exchange for each topic that you wish to
create.  Then use the name of the exchange as the name of the topic.  under
the covers the Java Broker will create a temporary queue for each
subscription, much as AMQP 0.8/9/10 do.

-- Rob


> >
> >  Regards,
> > Rakesh
> >
>