import pika
import json
import time

connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()

channel.queue_declare(queue='order_processing_queue')

channel.queue_bind(exchange='online_store_events', queue='order_processing_queue')

def callback(ch, method, properties, body):
  message = json.loads(body.decode('utf-8'))
  print(f"Received message in order_processing_queue: {message}")
  time.sleep(2)

channel.basic_consume(queue='order_processing_queue', on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()