You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Sajith Kariyawasam <sa...@gmail.com> on 2012/09/05 08:55:27 UTC

Dynamic Queues in Qpid

Hi,

Is it possible in Qpid, to create a queues dynamically, make those
queues persistent , and let subscribers subscribe to  it ?


-- 
Best Regards
Sajith

Re: Dynamic Queues in Qpid

Posted by Sajith Kariyawasam <sa...@gmail.com>.
Seems I got that.. i have to do the proper config under in
virtualhosts.xml, <store> element

On Wed, Sep 5, 2012 at 4:01 PM, Sajith Kariyawasam <sa...@gmail.com> wrote:

> Hi,
>
> I tried making the queue persistent, I created using  node:{durable:
> True}} option, it gets created, and I could seen in Management console as
> well that the queue (sajith_queue_test)
> is durable, and other two default queues are not durable. (refer the
> attached screen shot)
>
> And when I restart the broker I could only see the default two queues,
> "ping" and "queue", even though those are durable-false, and my newly
> created durable queue is gone.. ?
>
> I saw, Qpid java broker has enabled persistence via Derby DB. Do I have to
> enable Derby DB related settings?
>
>
> On Wed, Sep 5, 2012 at 2:50 PM, Sajith Kariyawasam <sa...@gmail.com>wrote:
>
>> On Wed, Sep 5, 2012 at 2:48 PM, Rob Godfrey <ro...@gmail.com>wrote:
>>
>>> On 5 September 2012 10:57, Sajith Kariyawasam <sa...@gmail.com> wrote:
>>>
>>> > On Wed, Sep 5, 2012 at 2:08 PM, Rob Godfrey <ro...@gmail.com>
>>> > wrote:
>>> >
>>> > > On 5 September 2012 10:20, Sajith Kariyawasam <sa...@gmail.com>
>>> wrote:
>>> > >
>>> > > > Thanks Gordon,
>>> > > >
>>> > > > I was able to create a Dynamic queue ..
>>> > > >
>>> > > > Then I was trying to write a message consumer to consume messages
>>> from
>>> > > that
>>> > > > particular queue dynamically created. For the time being I tried
>>> both
>>> > the
>>> > > > publisher code as well as the consumer code in Java,
>>> > > >
>>> > > > Here are my code samples..
>>> > > >
>>> > > > Sender.java
>>> > > > -----------------
>>> > > >                         Connection connection = new
>>> > > > AMQConnection("amqp://guest:guest@test
>>> > > > /?brokerlist='tcp://localhost:5672'");
>>> > > > Session session = connection.createSession(false,
>>> > > > Session.AUTO_ACKNOWLEDGE);
>>> > > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
>>> > > {create:
>>> > > > always}");
>>> > > > MessageProducer producer = session.createProducer(queue);
>>> > > > TextMessage message = session.createTextMessage("created234");
>>> > > > producer.send(message);
>>> > > >
>>> > > >
>>> > > >
>>> > > > Receiver.java
>>> > > > ------------------
>>> > > > Connection connection = new AMQConnection("amqp://guest:guest@test
>>> > > > /?brokerlist='tcp://localhost:5672'");
>>> > > > Session session = connection.createSession(false,
>>> > > > Session.AUTO_ACKNOWLEDGE);
>>> > > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
>>> > > {create:
>>> > > > always}");
>>> > > > MessageConsumer consumer = session.createConsumer(queue);
>>> > > > Message message = consumer.receive();
>>> > > > System.out.println("Receieved : " + message);
>>> > > >
>>> > > >
>>> > > >
>>> > > Does calling start() on the connection object before trying to
>>> receive
>>> > > help?
>>> > >
>>> > > -- Rob
>>> > >
>>> > >
>>> > Thanks Rob..! Yeah it works.. :)
>>> >
>>> > Now, why don't we require to invoke connection.start() of the sender?
>>> >
>>> >
>>> >
>>> The JMS spec defines start() as relating only to the receiving of
>>> messages.
>>> Weird, I agree, but such is the specification.
>>>
>>> Cheers,
>>> Rob
>>>
>>>
>> Cool..! :)
>>
>> Thanks,
>> Sajith
>>
>>
>>>
>>> > >
>>> > > >
>>> > > > Here, I'm expecting that receiver will consume the message which
>>> was
>>> > > > earlier sent by the Sender, but I don't get any messages printed in
>>> > > > Receiver's side.
>>> > > >
>>> > > > I verified in Qpid-management console as well, there I can see that
>>> > queue
>>> > > > "sajith_queue_test" has been created, and shows following
>>> statistics,
>>> > > which
>>> > > > are of relevant
>>> > > >         MessageCount :                 1
>>> > > >         ReceivedMessagCount :      1
>>> > > >         ConsumerCount :                1
>>> > > >         ActiveConsumerCount :       0
>>> > > >
>>> > > > Seems consumer has not been active.. could this be a problem ?
>>> > > >
>>> > > > Also, Im confused a bit, that is, in this way I'm sending and
>>> receiving
>>> > > > messages directly to the Queue, but not via an Exchange, isn't it?
>>> > > > According to the AMQP spec, as I
>>> > > > understood, we should deal with an Exchange, and based on the
>>> bindings
>>> > > only
>>> > > > messages are sent to the particular queues.
>>> > > >
>>> > > > Appreciate if you could shed some light in order to get my
>>> confusions
>>> > > > sorted out..
>>> > > >
>>> > > > Thanks
>>> > > > Sajith
>>> > > >
>>> > > >
>>> > > >
>>> > > > On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com>
>>> wrote:
>>> > > >
>>> > > > > On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
>>> > > > >
>>> > > > >> Is it possible in Qpid, to create a queues dynamically, make
>>> those
>>> > > > >> queues persistent , and let subscribers subscribe to  it ?
>>> > > > >>
>>> > > > >
>>> > > > > Yes. You can use an address of the form:
>>> > > > >
>>> > > > >   my-queue; {create:always, node:{durable:True}}
>>> > > > >
>>> > > > > This can be used as the address for which you create a receiver
>>> in
>>> > the
>>> > > > > c++/python APIs, and as the configuration for the Destination
>>> object
>>> > > for
>>> > > > > which you create a MessageConsumer in JMS.
>>> > > > >
>>> > > > > If you haven't already done so, I would suggest reading
>>> > > > >
>>> > http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/
>>> > > <
>>> > > > http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/
>>> > >which
>>> > > > has some more detail on the other capabilities of addressing.
>>> > > > >
>>> > > > >
>>> > > > >
>>> > >
>>> ------------------------------**------------------------------**---------
>>> > > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<
>>> > > > users-unsubscribe@qpid.apache.org>
>>> > > > > For additional commands, e-mail: users-help@qpid.apache.org
>>> > > > >
>>> > > > >
>>> > > >
>>> > > >
>>> > > > --
>>> > > > Best Regards
>>> > > > Sajith
>>> > > >
>>> > >
>>> >
>>> >
>>> >
>>> > --
>>> > Best Regards
>>> > Sajith
>>> >
>>>
>>
>>
>>
>> --
>> Best Regards
>> Sajith
>>
>>
>
>
> --
> Best Regards
> Sajith
>
>


-- 
Best Regards
Sajith

Re: Dynamic Queues in Qpid

Posted by Sajith Kariyawasam <sa...@gmail.com>.
Hi,

I tried making the queue persistent, I created using  node:{durable: True}}
option, it gets created, and I could seen in Management console as well
that the queue (sajith_queue_test)
is durable, and other two default queues are not durable. (refer the
attached screen shot)

And when I restart the broker I could only see the default two queues,
"ping" and "queue", even though those are durable-false, and my newly
created durable queue is gone.. ?

I saw, Qpid java broker has enabled persistence via Derby DB. Do I have to
enable Derby DB related settings?

On Wed, Sep 5, 2012 at 2:50 PM, Sajith Kariyawasam <sa...@gmail.com> wrote:

> On Wed, Sep 5, 2012 at 2:48 PM, Rob Godfrey <ro...@gmail.com>wrote:
>
>> On 5 September 2012 10:57, Sajith Kariyawasam <sa...@gmail.com> wrote:
>>
>> > On Wed, Sep 5, 2012 at 2:08 PM, Rob Godfrey <ro...@gmail.com>
>> > wrote:
>> >
>> > > On 5 September 2012 10:20, Sajith Kariyawasam <sa...@gmail.com>
>> wrote:
>> > >
>> > > > Thanks Gordon,
>> > > >
>> > > > I was able to create a Dynamic queue ..
>> > > >
>> > > > Then I was trying to write a message consumer to consume messages
>> from
>> > > that
>> > > > particular queue dynamically created. For the time being I tried
>> both
>> > the
>> > > > publisher code as well as the consumer code in Java,
>> > > >
>> > > > Here are my code samples..
>> > > >
>> > > > Sender.java
>> > > > -----------------
>> > > >                         Connection connection = new
>> > > > AMQConnection("amqp://guest:guest@test
>> > > > /?brokerlist='tcp://localhost:5672'");
>> > > > Session session = connection.createSession(false,
>> > > > Session.AUTO_ACKNOWLEDGE);
>> > > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
>> > > {create:
>> > > > always}");
>> > > > MessageProducer producer = session.createProducer(queue);
>> > > > TextMessage message = session.createTextMessage("created234");
>> > > > producer.send(message);
>> > > >
>> > > >
>> > > >
>> > > > Receiver.java
>> > > > ------------------
>> > > > Connection connection = new AMQConnection("amqp://guest:guest@test
>> > > > /?brokerlist='tcp://localhost:5672'");
>> > > > Session session = connection.createSession(false,
>> > > > Session.AUTO_ACKNOWLEDGE);
>> > > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
>> > > {create:
>> > > > always}");
>> > > > MessageConsumer consumer = session.createConsumer(queue);
>> > > > Message message = consumer.receive();
>> > > > System.out.println("Receieved : " + message);
>> > > >
>> > > >
>> > > >
>> > > Does calling start() on the connection object before trying to receive
>> > > help?
>> > >
>> > > -- Rob
>> > >
>> > >
>> > Thanks Rob..! Yeah it works.. :)
>> >
>> > Now, why don't we require to invoke connection.start() of the sender?
>> >
>> >
>> >
>> The JMS spec defines start() as relating only to the receiving of
>> messages.
>> Weird, I agree, but such is the specification.
>>
>> Cheers,
>> Rob
>>
>>
> Cool..! :)
>
> Thanks,
> Sajith
>
>
>>
>> > >
>> > > >
>> > > > Here, I'm expecting that receiver will consume the message which was
>> > > > earlier sent by the Sender, but I don't get any messages printed in
>> > > > Receiver's side.
>> > > >
>> > > > I verified in Qpid-management console as well, there I can see that
>> > queue
>> > > > "sajith_queue_test" has been created, and shows following
>> statistics,
>> > > which
>> > > > are of relevant
>> > > >         MessageCount :                 1
>> > > >         ReceivedMessagCount :      1
>> > > >         ConsumerCount :                1
>> > > >         ActiveConsumerCount :       0
>> > > >
>> > > > Seems consumer has not been active.. could this be a problem ?
>> > > >
>> > > > Also, Im confused a bit, that is, in this way I'm sending and
>> receiving
>> > > > messages directly to the Queue, but not via an Exchange, isn't it?
>> > > > According to the AMQP spec, as I
>> > > > understood, we should deal with an Exchange, and based on the
>> bindings
>> > > only
>> > > > messages are sent to the particular queues.
>> > > >
>> > > > Appreciate if you could shed some light in order to get my
>> confusions
>> > > > sorted out..
>> > > >
>> > > > Thanks
>> > > > Sajith
>> > > >
>> > > >
>> > > >
>> > > > On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com>
>> wrote:
>> > > >
>> > > > > On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
>> > > > >
>> > > > >> Is it possible in Qpid, to create a queues dynamically, make
>> those
>> > > > >> queues persistent , and let subscribers subscribe to  it ?
>> > > > >>
>> > > > >
>> > > > > Yes. You can use an address of the form:
>> > > > >
>> > > > >   my-queue; {create:always, node:{durable:True}}
>> > > > >
>> > > > > This can be used as the address for which you create a receiver in
>> > the
>> > > > > c++/python APIs, and as the configuration for the Destination
>> object
>> > > for
>> > > > > which you create a MessageConsumer in JMS.
>> > > > >
>> > > > > If you haven't already done so, I would suggest reading
>> > > > >
>> > http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/
>> > > <
>> > > > http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/
>> > >which
>> > > > has some more detail on the other capabilities of addressing.
>> > > > >
>> > > > >
>> > > > >
>> > >
>> ------------------------------**------------------------------**---------
>> > > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<
>> > > > users-unsubscribe@qpid.apache.org>
>> > > > > For additional commands, e-mail: users-help@qpid.apache.org
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Best Regards
>> > > > Sajith
>> > > >
>> > >
>> >
>> >
>> >
>> > --
>> > Best Regards
>> > Sajith
>> >
>>
>
>
>
> --
> Best Regards
> Sajith
>
>


-- 
Best Regards
Sajith

Re: Dynamic Queues in Qpid

Posted by Sajith Kariyawasam <sa...@gmail.com>.
On Wed, Sep 5, 2012 at 2:48 PM, Rob Godfrey <ro...@gmail.com> wrote:

> On 5 September 2012 10:57, Sajith Kariyawasam <sa...@gmail.com> wrote:
>
> > On Wed, Sep 5, 2012 at 2:08 PM, Rob Godfrey <ro...@gmail.com>
> > wrote:
> >
> > > On 5 September 2012 10:20, Sajith Kariyawasam <sa...@gmail.com>
> wrote:
> > >
> > > > Thanks Gordon,
> > > >
> > > > I was able to create a Dynamic queue ..
> > > >
> > > > Then I was trying to write a message consumer to consume messages
> from
> > > that
> > > > particular queue dynamically created. For the time being I tried both
> > the
> > > > publisher code as well as the consumer code in Java,
> > > >
> > > > Here are my code samples..
> > > >
> > > > Sender.java
> > > > -----------------
> > > >                         Connection connection = new
> > > > AMQConnection("amqp://guest:guest@test
> > > > /?brokerlist='tcp://localhost:5672'");
> > > > Session session = connection.createSession(false,
> > > > Session.AUTO_ACKNOWLEDGE);
> > > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
> > > {create:
> > > > always}");
> > > > MessageProducer producer = session.createProducer(queue);
> > > > TextMessage message = session.createTextMessage("created234");
> > > > producer.send(message);
> > > >
> > > >
> > > >
> > > > Receiver.java
> > > > ------------------
> > > > Connection connection = new AMQConnection("amqp://guest:guest@test
> > > > /?brokerlist='tcp://localhost:5672'");
> > > > Session session = connection.createSession(false,
> > > > Session.AUTO_ACKNOWLEDGE);
> > > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
> > > {create:
> > > > always}");
> > > > MessageConsumer consumer = session.createConsumer(queue);
> > > > Message message = consumer.receive();
> > > > System.out.println("Receieved : " + message);
> > > >
> > > >
> > > >
> > > Does calling start() on the connection object before trying to receive
> > > help?
> > >
> > > -- Rob
> > >
> > >
> > Thanks Rob..! Yeah it works.. :)
> >
> > Now, why don't we require to invoke connection.start() of the sender?
> >
> >
> >
> The JMS spec defines start() as relating only to the receiving of messages.
> Weird, I agree, but such is the specification.
>
> Cheers,
> Rob
>
>
Cool..! :)

Thanks,
Sajith


>
> > >
> > > >
> > > > Here, I'm expecting that receiver will consume the message which was
> > > > earlier sent by the Sender, but I don't get any messages printed in
> > > > Receiver's side.
> > > >
> > > > I verified in Qpid-management console as well, there I can see that
> > queue
> > > > "sajith_queue_test" has been created, and shows following statistics,
> > > which
> > > > are of relevant
> > > >         MessageCount :                 1
> > > >         ReceivedMessagCount :      1
> > > >         ConsumerCount :                1
> > > >         ActiveConsumerCount :       0
> > > >
> > > > Seems consumer has not been active.. could this be a problem ?
> > > >
> > > > Also, Im confused a bit, that is, in this way I'm sending and
> receiving
> > > > messages directly to the Queue, but not via an Exchange, isn't it?
> > > > According to the AMQP spec, as I
> > > > understood, we should deal with an Exchange, and based on the
> bindings
> > > only
> > > > messages are sent to the particular queues.
> > > >
> > > > Appreciate if you could shed some light in order to get my confusions
> > > > sorted out..
> > > >
> > > > Thanks
> > > > Sajith
> > > >
> > > >
> > > >
> > > > On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com> wrote:
> > > >
> > > > > On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
> > > > >
> > > > >> Is it possible in Qpid, to create a queues dynamically, make those
> > > > >> queues persistent , and let subscribers subscribe to  it ?
> > > > >>
> > > > >
> > > > > Yes. You can use an address of the form:
> > > > >
> > > > >   my-queue; {create:always, node:{durable:True}}
> > > > >
> > > > > This can be used as the address for which you create a receiver in
> > the
> > > > > c++/python APIs, and as the configuration for the Destination
> object
> > > for
> > > > > which you create a MessageConsumer in JMS.
> > > > >
> > > > > If you haven't already done so, I would suggest reading
> > > > >
> > http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/
> > > <
> > > > http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/
> > >which
> > > > has some more detail on the other capabilities of addressing.
> > > > >
> > > > >
> > > > >
> > >
> ------------------------------**------------------------------**---------
> > > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<
> > > > users-unsubscribe@qpid.apache.org>
> > > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Best Regards
> > > > Sajith
> > > >
> > >
> >
> >
> >
> > --
> > Best Regards
> > Sajith
> >
>



-- 
Best Regards
Sajith

Re: Dynamic Queues in Qpid

Posted by Rob Godfrey <ro...@gmail.com>.
On 5 September 2012 10:57, Sajith Kariyawasam <sa...@gmail.com> wrote:

> On Wed, Sep 5, 2012 at 2:08 PM, Rob Godfrey <ro...@gmail.com>
> wrote:
>
> > On 5 September 2012 10:20, Sajith Kariyawasam <sa...@gmail.com> wrote:
> >
> > > Thanks Gordon,
> > >
> > > I was able to create a Dynamic queue ..
> > >
> > > Then I was trying to write a message consumer to consume messages from
> > that
> > > particular queue dynamically created. For the time being I tried both
> the
> > > publisher code as well as the consumer code in Java,
> > >
> > > Here are my code samples..
> > >
> > > Sender.java
> > > -----------------
> > >                         Connection connection = new
> > > AMQConnection("amqp://guest:guest@test
> > > /?brokerlist='tcp://localhost:5672'");
> > > Session session = connection.createSession(false,
> > > Session.AUTO_ACKNOWLEDGE);
> > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
> > {create:
> > > always}");
> > > MessageProducer producer = session.createProducer(queue);
> > > TextMessage message = session.createTextMessage("created234");
> > > producer.send(message);
> > >
> > >
> > >
> > > Receiver.java
> > > ------------------
> > > Connection connection = new AMQConnection("amqp://guest:guest@test
> > > /?brokerlist='tcp://localhost:5672'");
> > > Session session = connection.createSession(false,
> > > Session.AUTO_ACKNOWLEDGE);
> > > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
> > {create:
> > > always}");
> > > MessageConsumer consumer = session.createConsumer(queue);
> > > Message message = consumer.receive();
> > > System.out.println("Receieved : " + message);
> > >
> > >
> > >
> > Does calling start() on the connection object before trying to receive
> > help?
> >
> > -- Rob
> >
> >
> Thanks Rob..! Yeah it works.. :)
>
> Now, why don't we require to invoke connection.start() of the sender?
>
>
>
The JMS spec defines start() as relating only to the receiving of messages.
Weird, I agree, but such is the specification.

Cheers,
Rob


> >
> > >
> > > Here, I'm expecting that receiver will consume the message which was
> > > earlier sent by the Sender, but I don't get any messages printed in
> > > Receiver's side.
> > >
> > > I verified in Qpid-management console as well, there I can see that
> queue
> > > "sajith_queue_test" has been created, and shows following statistics,
> > which
> > > are of relevant
> > >         MessageCount :                 1
> > >         ReceivedMessagCount :      1
> > >         ConsumerCount :                1
> > >         ActiveConsumerCount :       0
> > >
> > > Seems consumer has not been active.. could this be a problem ?
> > >
> > > Also, Im confused a bit, that is, in this way I'm sending and receiving
> > > messages directly to the Queue, but not via an Exchange, isn't it?
> > > According to the AMQP spec, as I
> > > understood, we should deal with an Exchange, and based on the bindings
> > only
> > > messages are sent to the particular queues.
> > >
> > > Appreciate if you could shed some light in order to get my confusions
> > > sorted out..
> > >
> > > Thanks
> > > Sajith
> > >
> > >
> > >
> > > On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com> wrote:
> > >
> > > > On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
> > > >
> > > >> Is it possible in Qpid, to create a queues dynamically, make those
> > > >> queues persistent , and let subscribers subscribe to  it ?
> > > >>
> > > >
> > > > Yes. You can use an address of the form:
> > > >
> > > >   my-queue; {create:always, node:{durable:True}}
> > > >
> > > > This can be used as the address for which you create a receiver in
> the
> > > > c++/python APIs, and as the configuration for the Destination object
> > for
> > > > which you create a MessageConsumer in JMS.
> > > >
> > > > If you haven't already done so, I would suggest reading
> > > >
> http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/
> > <
> > > http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/
> >which
> > > has some more detail on the other capabilities of addressing.
> > > >
> > > >
> > > >
> > ------------------------------**------------------------------**---------
> > > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<
> > > users-unsubscribe@qpid.apache.org>
> > > > For additional commands, e-mail: users-help@qpid.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > Best Regards
> > > Sajith
> > >
> >
>
>
>
> --
> Best Regards
> Sajith
>

Re: Dynamic Queues in Qpid

Posted by Sajith Kariyawasam <sa...@gmail.com>.
On Wed, Sep 5, 2012 at 2:08 PM, Rob Godfrey <ro...@gmail.com> wrote:

> On 5 September 2012 10:20, Sajith Kariyawasam <sa...@gmail.com> wrote:
>
> > Thanks Gordon,
> >
> > I was able to create a Dynamic queue ..
> >
> > Then I was trying to write a message consumer to consume messages from
> that
> > particular queue dynamically created. For the time being I tried both the
> > publisher code as well as the consumer code in Java,
> >
> > Here are my code samples..
> >
> > Sender.java
> > -----------------
> >                         Connection connection = new
> > AMQConnection("amqp://guest:guest@test
> > /?brokerlist='tcp://localhost:5672'");
> > Session session = connection.createSession(false,
> > Session.AUTO_ACKNOWLEDGE);
> > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
> {create:
> > always}");
> > MessageProducer producer = session.createProducer(queue);
> > TextMessage message = session.createTextMessage("created234");
> > producer.send(message);
> >
> >
> >
> > Receiver.java
> > ------------------
> > Connection connection = new AMQConnection("amqp://guest:guest@test
> > /?brokerlist='tcp://localhost:5672'");
> > Session session = connection.createSession(false,
> > Session.AUTO_ACKNOWLEDGE);
> > Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test;
> {create:
> > always}");
> > MessageConsumer consumer = session.createConsumer(queue);
> > Message message = consumer.receive();
> > System.out.println("Receieved : " + message);
> >
> >
> >
> Does calling start() on the connection object before trying to receive
> help?
>
> -- Rob
>
>
Thanks Rob..! Yeah it works.. :)

Now, why don't we require to invoke connection.start() of the sender?


>
> >
> > Here, I'm expecting that receiver will consume the message which was
> > earlier sent by the Sender, but I don't get any messages printed in
> > Receiver's side.
> >
> > I verified in Qpid-management console as well, there I can see that queue
> > "sajith_queue_test" has been created, and shows following statistics,
> which
> > are of relevant
> >         MessageCount :                 1
> >         ReceivedMessagCount :      1
> >         ConsumerCount :                1
> >         ActiveConsumerCount :       0
> >
> > Seems consumer has not been active.. could this be a problem ?
> >
> > Also, Im confused a bit, that is, in this way I'm sending and receiving
> > messages directly to the Queue, but not via an Exchange, isn't it?
> > According to the AMQP spec, as I
> > understood, we should deal with an Exchange, and based on the bindings
> only
> > messages are sent to the particular queues.
> >
> > Appreciate if you could shed some light in order to get my confusions
> > sorted out..
> >
> > Thanks
> > Sajith
> >
> >
> >
> > On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com> wrote:
> >
> > > On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
> > >
> > >> Is it possible in Qpid, to create a queues dynamically, make those
> > >> queues persistent , and let subscribers subscribe to  it ?
> > >>
> > >
> > > Yes. You can use an address of the form:
> > >
> > >   my-queue; {create:always, node:{durable:True}}
> > >
> > > This can be used as the address for which you create a receiver in the
> > > c++/python APIs, and as the configuration for the Destination object
> for
> > > which you create a MessageConsumer in JMS.
> > >
> > > If you haven't already done so, I would suggest reading
> > > http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/
> <
> > http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/>which
> > has some more detail on the other capabilities of addressing.
> > >
> > >
> > >
> ------------------------------**------------------------------**---------
> > > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<
> > users-unsubscribe@qpid.apache.org>
> > > For additional commands, e-mail: users-help@qpid.apache.org
> > >
> > >
> >
> >
> > --
> > Best Regards
> > Sajith
> >
>



-- 
Best Regards
Sajith

Re: Dynamic Queues in Qpid

Posted by Rob Godfrey <ro...@gmail.com>.
On 5 September 2012 10:20, Sajith Kariyawasam <sa...@gmail.com> wrote:

> Thanks Gordon,
>
> I was able to create a Dynamic queue ..
>
> Then I was trying to write a message consumer to consume messages from that
> particular queue dynamically created. For the time being I tried both the
> publisher code as well as the consumer code in Java,
>
> Here are my code samples..
>
> Sender.java
> -----------------
>                         Connection connection = new
> AMQConnection("amqp://guest:guest@test
> /?brokerlist='tcp://localhost:5672'");
> Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test; {create:
> always}");
> MessageProducer producer = session.createProducer(queue);
> TextMessage message = session.createTextMessage("created234");
> producer.send(message);
>
>
>
> Receiver.java
> ------------------
> Connection connection = new AMQConnection("amqp://guest:guest@test
> /?brokerlist='tcp://localhost:5672'");
> Session session = connection.createSession(false,
> Session.AUTO_ACKNOWLEDGE);
> Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test; {create:
> always}");
> MessageConsumer consumer = session.createConsumer(queue);
> Message message = consumer.receive();
> System.out.println("Receieved : " + message);
>
>
>
Does calling start() on the connection object before trying to receive help?

-- Rob


>
> Here, I'm expecting that receiver will consume the message which was
> earlier sent by the Sender, but I don't get any messages printed in
> Receiver's side.
>
> I verified in Qpid-management console as well, there I can see that queue
> "sajith_queue_test" has been created, and shows following statistics, which
> are of relevant
>         MessageCount :                 1
>         ReceivedMessagCount :      1
>         ConsumerCount :                1
>         ActiveConsumerCount :       0
>
> Seems consumer has not been active.. could this be a problem ?
>
> Also, Im confused a bit, that is, in this way I'm sending and receiving
> messages directly to the Queue, but not via an Exchange, isn't it?
> According to the AMQP spec, as I
> understood, we should deal with an Exchange, and based on the bindings only
> messages are sent to the particular queues.
>
> Appreciate if you could shed some light in order to get my confusions
> sorted out..
>
> Thanks
> Sajith
>
>
>
> On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com> wrote:
>
> > On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
> >
> >> Is it possible in Qpid, to create a queues dynamically, make those
> >> queues persistent , and let subscribers subscribe to  it ?
> >>
> >
> > Yes. You can use an address of the form:
> >
> >   my-queue; {create:always, node:{durable:True}}
> >
> > This can be used as the address for which you create a receiver in the
> > c++/python APIs, and as the configuration for the Destination object for
> > which you create a MessageConsumer in JMS.
> >
> > If you haven't already done so, I would suggest reading
> > http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/<
> http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/>which
> has some more detail on the other capabilities of addressing.
> >
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<
> users-unsubscribe@qpid.apache.org>
> > For additional commands, e-mail: users-help@qpid.apache.org
> >
> >
>
>
> --
> Best Regards
> Sajith
>

Re: Dynamic Queues in Qpid

Posted by Sajith Kariyawasam <sa...@gmail.com>.
Thanks Gordon,

I was able to create a Dynamic queue ..

Then I was trying to write a message consumer to consume messages from that
particular queue dynamically created. For the time being I tried both the
publisher code as well as the consumer code in Java,

Here are my code samples..

Sender.java
-----------------
                        Connection connection = new
AMQConnection("amqp://guest:guest@test/?brokerlist='tcp://localhost:5672'");
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test; {create:
always}");
MessageProducer producer = session.createProducer(queue);
TextMessage message = session.createTextMessage("created234");
producer.send(message);



Receiver.java
------------------
Connection connection = new AMQConnection("amqp://guest:guest@test
/?brokerlist='tcp://localhost:5672'");
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Destination queue = new AMQAnyDestination("ADDR:sajith_queue_test; {create:
always}");
MessageConsumer consumer = session.createConsumer(queue);
Message message = consumer.receive();
System.out.println("Receieved : " + message);



Here, I'm expecting that receiver will consume the message which was
earlier sent by the Sender, but I don't get any messages printed in
Receiver's side.

I verified in Qpid-management console as well, there I can see that queue
"sajith_queue_test" has been created, and shows following statistics, which
are of relevant
        MessageCount :                 1
        ReceivedMessagCount :      1
        ConsumerCount :                1
        ActiveConsumerCount :       0

Seems consumer has not been active.. could this be a problem ?

Also, Im confused a bit, that is, in this way I'm sending and receiving
messages directly to the Queue, but not via an Exchange, isn't it?
According to the AMQP spec, as I
understood, we should deal with an Exchange, and based on the bindings only
messages are sent to the particular queues.

Appreciate if you could shed some light in order to get my confusions
sorted out..

Thanks
Sajith



On Wed, Sep 5, 2012 at 12:33 PM, Gordon Sim <gs...@redhat.com> wrote:

> On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
>
>> Is it possible in Qpid, to create a queues dynamically, make those
>> queues persistent , and let subscribers subscribe to  it ?
>>
>
> Yes. You can use an address of the form:
>
>   my-queue; {create:always, node:{durable:True}}
>
> This can be used as the address for which you create a receiver in the
> c++/python APIs, and as the configuration for the Destination object for
> which you create a MessageConsumer in JMS.
>
> If you haven't already done so, I would suggest reading
> http://qpid.apache.org/books/**0.18/Programming-In-Apache-**Qpid/html/<http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/>which has some more detail on the other capabilities of addressing.
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@qpid.apache.**org<us...@qpid.apache.org>
> For additional commands, e-mail: users-help@qpid.apache.org
>
>


-- 
Best Regards
Sajith

Re: Dynamic Queues in Qpid

Posted by Gordon Sim <gs...@redhat.com>.
On 09/05/2012 07:55 AM, Sajith Kariyawasam wrote:
> Is it possible in Qpid, to create a queues dynamically, make those
> queues persistent , and let subscribers subscribe to  it ?

Yes. You can use an address of the form:

   my-queue; {create:always, node:{durable:True}}

This can be used as the address for which you create a receiver in the 
c++/python APIs, and as the configuration for the Destination object for 
which you create a MessageConsumer in JMS.

If you haven't already done so, I would suggest reading 
http://qpid.apache.org/books/0.18/Programming-In-Apache-Qpid/html/ which 
has some more detail on the other capabilities of addressing.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@qpid.apache.org
For additional commands, e-mail: users-help@qpid.apache.org