rpc process data events #348
Opperessor
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
producer.py
`import json
import time
import pika
class RabbitMqService:
queue_name = None
callback_queue = None
channel = None
connection = None
corr_id = None
response = None
ob = RabbitMqService("test_queue")
ob.value()
consumer.py
import json
import pika
class RabbitMqService:
def init(self):
self.connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
self.channel = self.connection.channel()
self.input_queue = "target_queue"
self.channel.queue_declare(queue=self.input_queue, durable=True, arguments={"x-queue-type": "quorum"})
self.channel.basic_qos(prefetch_count=1)
self.channel.basic_consume(queue=self.input_queue, on_message_callback=self.on_request)
ob = RabbitMqService()
ob._consumption()
`
When i publish all the values into the queue and process_data_events, im only able to get the output for the first value(of n in producer.py). how can i get for all the values. I know it can be done with process _data_events in an infinite while loop until the response is not none but i dont want an infinite loop. Is there a different way or a method that can be used to get the result for all the values, Have a minimal knowledge on RMQ, can someone pls Help me out.
Beta Was this translation helpful? Give feedback.
All reactions