You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by xbhanu <xb...@gmail.com> on 2013/12/12 13:38:21 UTC
Problems with the AMQP python messenger API
Hi,
I am using AMQP Messenger API in Python and I am getting duplicate messages
while using queues. Even though my consumer receives the message, ActiveMQ
does not increment the dequeue count (seen through Jconsole). As a result,
whenever I connect back the consumer I end up getting the same messages
again and again. So a message once enqueued is received every time again.
The other interesting thing here is I am printing the body of the message (a
simple string), the body gets printed only the first time.
Anybody, any idea on how to tell ActiveMQ that I have received the message
!! Some sort of acknowledgement ?? I do not see any way of acking in the
messenger API !!
Thanks,
Bhanu
--
View this message in context: http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Problems with the AMQP python messenger API
Posted by Gordon Sim <gs...@redhat.com>.
On 12/12/2013 04:07 PM, xbhanu wrote:
> One more thing, I dont think there is a concept of durable topic
> subscriptions in AMQP ? True right ?
Well, AMQP doesn't explicitly define 'topics'. It does however define
distribution modes. More importantly it covers how the lifecycle of a
'terminus' can be specified and whether it is durable or not. This gives
you the ability to expose durable topic subscriptions in a standard manner.
However the proton messenger API does not yet provide the ability to
control those aspects of the link establishment for subscriptions. In
summary, AMQP supports it, proton messenger does not.
Re: Problems with the AMQP python messenger API
Posted by Timothy Bish <ta...@gmail.com>.
On 12/12/2013 11:07 AM, xbhanu wrote:
> Aha !! Works like a charm now. Thanks Gordon. It would be good if some one
> puts this incoming_window thing along with some documentation in the proton
> sender receiver examples as
> well.(qpid-proton-0.5/examples/messenger/py/recv.py).
You should probably direct that to the proton mailing lists or Jira
since this is AMQ and we don't work on those clients source trees.
>
> One more thing, I dont think there is a concept of durable topic
> subscriptions in AMQP ? True right ?
>
>
> On Thu, Dec 12, 2013 at 7:57 PM, Gordon Sim-2 [via ActiveMQ] <
> ml-node+s2283324n4675461h20@n4.nabble.com> wrote:
>
>> On 12/12/2013 01:33 PM, xbhanu wrote:
>>> Yes, and infact i am doing exactly this. But the accept call has no
>> effect
>>> it seems.
>> You also need to set the incoming message window, e.g.
>>
>>> messenger = Messenger()
>>> messenger.start()
>> messenger.incoming_window = 10
>>
>>> messenger.subscribe(address)
>>>
>>> message = Message()
>>>
>>> while should_run:
>>> messenger.recv()
>>> while messenger.incoming:
>>> try:
>>> messenger.get(message)
>>> messenger.accept()
>>> except Exception, e:
>>> print "Exception occurred while retrieving the message:
>> " +
>>> e
>>> else:
>>> print "Destination: " + message.address + "\n" + \
>>> "Properties: " + str(message.properties) + "\n" + \
>>> "Body: " + str(message.body) + "\n"
>>>
>>> messenger.stop()
>>
>>
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451p4675461.html
>> To unsubscribe from Problems with the AMQP python messenger API, click
>> here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4675451&code=eGJoYW51QGdtYWlsLmNvbXw0Njc1NDUxfC04NDE4NTMxMTk=>
>> .
>> NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
--
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/
Re: Problems with the AMQP python messenger API
Posted by xbhanu <xb...@gmail.com>.
Aha !! Works like a charm now. Thanks Gordon. It would be good if some one
puts this incoming_window thing along with some documentation in the proton
sender receiver examples as
well.(qpid-proton-0.5/examples/messenger/py/recv.py).
One more thing, I dont think there is a concept of durable topic
subscriptions in AMQP ? True right ?
On Thu, Dec 12, 2013 at 7:57 PM, Gordon Sim-2 [via ActiveMQ] <
ml-node+s2283324n4675461h20@n4.nabble.com> wrote:
> On 12/12/2013 01:33 PM, xbhanu wrote:
> > Yes, and infact i am doing exactly this. But the accept call has no
> effect
> > it seems.
>
> You also need to set the incoming message window, e.g.
>
> > messenger = Messenger()
> > messenger.start()
>
> messenger.incoming_window = 10
>
> > messenger.subscribe(address)
> >
> > message = Message()
> >
> > while should_run:
> > messenger.recv()
> > while messenger.incoming:
> > try:
> > messenger.get(message)
> > messenger.accept()
> > except Exception, e:
> > print "Exception occurred while retrieving the message:
> " +
> > e
> > else:
> > print "Destination: " + message.address + "\n" + \
> > "Properties: " + str(message.properties) + "\n" + \
> > "Body: " + str(message.body) + "\n"
> >
> > messenger.stop()
>
>
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451p4675461.html
> To unsubscribe from Problems with the AMQP python messenger API, click
> here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4675451&code=eGJoYW51QGdtYWlsLmNvbXw0Njc1NDUxfC04NDE4NTMxMTk=>
> .
> NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
Bhanu Choudhary
Senior Member Technical,
D E Shaw India Software Ltd.
Hyderabad.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451p4675468.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Problems with the AMQP python messenger API
Posted by Gordon Sim <gs...@redhat.com>.
On 12/12/2013 01:33 PM, xbhanu wrote:
> Yes, and infact i am doing exactly this. But the accept call has no effect
> it seems.
You also need to set the incoming message window, e.g.
> messenger = Messenger()
> messenger.start()
messenger.incoming_window = 10
> messenger.subscribe(address)
>
> message = Message()
>
> while should_run:
> messenger.recv()
> while messenger.incoming:
> try:
> messenger.get(message)
> messenger.accept()
> except Exception, e:
> print "Exception occurred while retrieving the message: " +
> e
> else:
> print "Destination: " + message.address + "\n" + \
> "Properties: " + str(message.properties) + "\n" + \
> "Body: " + str(message.body) + "\n"
>
> messenger.stop()
Re: Problems with the AMQP python messenger API
Posted by xbhanu <xb...@gmail.com>.
Yes, and infact i am doing exactly this. But the accept call has no effect
it seems.
messenger = Messenger()
messenger.start()
messenger.subscribe(address)
message = Message()
while should_run:
messenger.recv()
while messenger.incoming:
try:
messenger.get(message)
messenger.accept()
except Exception, e:
print "Exception occurred while retrieving the message: " +
e
else:
print "Destination: " + message.address + "\n" + \
"Properties: " + str(message.properties) + "\n" + \
"Body: " + str(message.body) + "\n"
messenger.stop()
Output for the first time:
Destination: queue://test_accept.0
Properties: None
Body:
TestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestData
Destination: queue://test_accept.0
Properties: None
Body:
TestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestDataTestData
Destination: queue://test_accept.0
Properties: None
Body: SHUTDOWN
Output if I run the consumer again:
Destination: queue://test_accept.0
Properties: None
Body:
Destination: queue://test_accept.0
Properties: None
Body:
Destination: queue://test_accept.0
Properties: None
Body:
Thanks,
Bhanu
On Thu, Dec 12, 2013 at 6:38 PM, ceposta [via ActiveMQ] <
ml-node+s2283324n4675454h3@n4.nabble.com> wrote:
> Something like this..
>
> 44 msg = Message()
> 45 while True:
> 46 mng.recv()
> 47 while mng.incoming:
> 48 try:
> 49 mng.get(msg)
> 50 mng.accept()
> 51 except Exception, e:
> 52 print e
> 53 else:
> 54 print msg.address, msg.subject or "(no subject)",
> msg.properties, msg.body
>
> On Thu, Dec 12, 2013 at 5:58 AM, Christian Posta
> <[hidden email] <http://user/SendEmail.jtp?type=node&node=4675454&i=0>>
> wrote:
>
> > That's right. You have to ack the message. Maybe you can post your
> consumer
> > python script?
> >
> >
> > On Thursday, December 12, 2013, xbhanu wrote:
> >>
> >> Hi,
> >>
> >> I am using AMQP Messenger API in Python and I am getting duplicate
> >> messages
> >> while using queues. Even though my consumer receives the message,
> ActiveMQ
> >> does not increment the dequeue count (seen through Jconsole). As a
> result,
> >> whenever I connect back the consumer I end up getting the same messages
> >> again and again. So a message once enqueued is received every time
> again.
> >> The other interesting thing here is I am printing the body of the
> message
> >> (a
> >> simple string), the body gets printed only the first time.
> >>
> >> Anybody, any idea on how to tell ActiveMQ that I have received the
> message
> >> !! Some sort of acknowledgement ?? I do not see any way of acking in
> the
> >> messenger API !!
> >>
> >> Thanks,
> >> Bhanu
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >
> >
> >
> > --
> > Christian Posta
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>
>
>
> --
> Christian Posta
> http://www.christianposta.com/blog
> twitter: @christianposta
> http://www.christianposta.com/blog
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451p4675454.html
> To unsubscribe from Problems with the AMQP python messenger API, click
> here<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4675451&code=eGJoYW51QGdtYWlsLmNvbXw0Njc1NDUxfC04NDE4NTMxMTk=>
> .
> NAML<http://activemq.2283324.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
Bhanu Choudhary
Senior Member Technical,
D E Shaw India Software Ltd.
Hyderabad.
--
View this message in context: http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451p4675456.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: Problems with the AMQP python messenger API
Posted by Christian Posta <ch...@gmail.com>.
Something like this..
44 msg = Message()
45 while True:
46 mng.recv()
47 while mng.incoming:
48 try:
49 mng.get(msg)
50 mng.accept()
51 except Exception, e:
52 print e
53 else:
54 print msg.address, msg.subject or "(no subject)",
msg.properties, msg.body
On Thu, Dec 12, 2013 at 5:58 AM, Christian Posta
<ch...@gmail.com> wrote:
> That's right. You have to ack the message. Maybe you can post your consumer
> python script?
>
>
> On Thursday, December 12, 2013, xbhanu wrote:
>>
>> Hi,
>>
>> I am using AMQP Messenger API in Python and I am getting duplicate
>> messages
>> while using queues. Even though my consumer receives the message, ActiveMQ
>> does not increment the dequeue count (seen through Jconsole). As a result,
>> whenever I connect back the consumer I end up getting the same messages
>> again and again. So a message once enqueued is received every time again.
>> The other interesting thing here is I am printing the body of the message
>> (a
>> simple string), the body gets printed only the first time.
>>
>> Anybody, any idea on how to tell ActiveMQ that I have received the message
>> !! Some sort of acknowledgement ?? I do not see any way of acking in the
>> messenger API !!
>>
>> Thanks,
>> Bhanu
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>
>
> --
> Christian Posta
> http://www.christianposta.com/blog
> twitter: @christianposta
>
--
Christian Posta
http://www.christianposta.com/blog
twitter: @christianposta
Re: Problems with the AMQP python messenger API
Posted by Christian Posta <ch...@gmail.com>.
That's right. You have to ack the message. Maybe you can post your consumer
python script?
On Thursday, December 12, 2013, xbhanu wrote:
> Hi,
>
> I am using AMQP Messenger API in Python and I am getting duplicate messages
> while using queues. Even though my consumer receives the message, ActiveMQ
> does not increment the dequeue count (seen through Jconsole). As a result,
> whenever I connect back the consumer I end up getting the same messages
> again and again. So a message once enqueued is received every time again.
> The other interesting thing here is I am printing the body of the message
> (a
> simple string), the body gets printed only the first time.
>
> Anybody, any idea on how to tell ActiveMQ that I have received the message
> !! Some sort of acknowledgement ?? I do not see any way of acking in the
> messenger API !!
>
> Thanks,
> Bhanu
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Problems-with-the-AMQP-python-messenger-API-tp4675451.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
--
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta