473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

To receive a message from rabbitmq only once not continuously

roberttonafelix
Hi,

I am using the below code for the receiving messages from the rabbitmq server...

The program was working fine but in the consuming part i don't need to consume continuously instead i required a to consume a message by message.

Expand|Select|Wrap|Line Numbers
  1. import pika
  2. import os
  3. import time
  4.  
  5.  
  6. connection = pika.BlockingConnection(pika.ConnectionParameters(
  7.         host='localhost'))
  8. channel = connection.channel()
  9.  
  10. channel.exchange_declare(exchange='acknowledgment',type="direct",durable=True,auto_delete=False)
  11. channel.queue_declare(queue="ACK",durable=True)
  12. channel.queue_bind(queue='ACK',exchange='acknowledgment',routing_key='acknowledgment')
  13.  
  14. def callback(ch, method, properties, body):
  15.     srt="%r" % (body)
  16.     print "Received"
  17. channel.basic_consume(callback,queue='ACK',no_ack=True,consumer_tag='acknowledgment')
  18. channel.start_consuming()
Kindly guide what type of code that should be modified for this....

Thanks and Regards,

Robert.J
Nov 26 '12 #1
0 1814

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Fred Hebert | last post by:
I am new to .NET and trying to convert some existing code to .NET. The application that is giving be problems is one that receives status messages from a device via WM_COPYDATA messages and logs,...
0
by: Chanh Nguyen | last post by:
Hi all, I have a problem. I want an application that sends a message to a NotifyIcon application (Tray Icon). I have a form MainFrm that will create the NofifyIcon. static void Main() {
1
by: Kitchen Bin | last post by:
Hi. I am trying to use Sockets to do multiple Send and Receives via HTTP (not simultaneously). A first pair of Send/Receives works fine and sure enough I receive HTML back, but the next...
1
by: rockdale | last post by:
Hi, all I am coding a asp.net application as user data entry and report interface. We also have another C#.net appplication (a server) does some other stuff, my webserver can send and receive...
2
by: Hooyoo | last post by:
Hello, guys. In my application, I need to receive a windows message from another window, and the other window is a MFC application using SendMessage to send a custom windows message. So, in my...
0
by: koh soo min | last post by:
Hi, Can anyone give me hints to write VB code for send and receive message between two computer using ComPort. Thanks.
4
by: folen | last post by:
Hi to every body, I am reading this forum since about two weeks, this forum has solved a lot of question that i had, thank to every body. I have a question about messages (WM_PAINT, etc...) in...
7
by: Guy Davidson | last post by:
Hi Folks, I'm having some issues with an small socket based server I'm writing, and I was hoping I could get some help. My code (attached below) us supposed to read an HTTP Post message...
25
tusovka
by: tusovka | last post by:
Because Firefox and IE render web pages differently, I cant get the same results. I working with many embedded tables that contain javascript functionality inside. What I have is a table that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.