Example #1
0
    count = int(count)
    count += 1
    return name + "-" + str(count)


def callback(ch, method, properties, body):
    print("Received a message %s" % body)
    sys.stdout.flush()
    message.send("I received a %s ball" % body)

    # Sleep a second
    time.sleep(1)

    # Throw the ball
    ball = transformBall(body)
    throwBall(ball)


print(welcome_message)

# Init message
message.init()

# Init other queue
connection = pp_queue.connect()
channel = connection.channel()
channel.queue_declare(queue=other_queue)

# Init queue
pp_queue.consume(queue_name, callback)
import pp_queue
import sys

MESSAGE_QUEUE = 'message'


def callback(ch, method, properties, body):
    print("Message: %s" % body)
    sys.stdout.flush()


print("Welcome to the Ping Pong solution")
pp_queue.consume(MESSAGE_QUEUE, callback)