Created
June 20, 2020 09:29
-
-
Save wh13371/96e6921698074b58b909df3b2ddde555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import pika | |
credentials = pika.PlainCredentials('fizz', 'fizz') | |
parameters = pika.ConnectionParameters(host='?.?.?.?', | |
port=5672, credentials=credentials) | |
connection = pika.BlockingConnection(parameters) | |
channel = connection.channel() | |
channel.exchange_declare(exchange='logs', exchange_type='fanout') | |
while 1: | |
message = str(time.time_ns()) | |
channel.basic_publish(exchange='logs', routing_key='', body=message) | |
print(" [x] Sent %r" % message) | |
time.sleep(1) | |
connection.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment