import pika
import random

EXCHANGE_NAME = 'beacon'

connection = pika.BlockingConnection(pika.ConnectionParameters('143.205.173.36', 30302, heartbeat=600, blocked_connection_timeout=300))
channel = connection.channel()

channel.exchange_declare(exchange=EXCHANGE_NAME, exchange_type='fanout')

message = f'test {random.random()}'
channel.basic_publish(exchange=EXCHANGE_NAME, routing_key='', body=message)

print(f"# Sent {message}")
connection.close()