File indexing completed on 2026-04-27 07:41:41
0001 import stomp
0002 import ssl
0003 from datetime import datetime
0004
0005 host = 'pandaserver02.sdcc.bnl.gov'
0006 port = 61612
0007 cafile = '<pathname to where full-chain.pem is>'
0008
0009 conn = stomp.Connection(host_and_ports=[(host, port)], vhost=host,try_loopback_connect=False)
0010
0011 conn.transport.set_ssl(
0012 for_hosts=[(host, port)],
0013 ca_certs=cafile,
0014 ssl_version=ssl.PROTOCOL_TLS_CLIENT
0015 )
0016
0017 try:
0018 conn.connect(login='<username>', passcode='<userpasswd>', wait=True, version='1.2')
0019 conn.send(destination='epictopic', body=f"[{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}] Hello from producer!")
0020 print("Message sent")
0021 conn.disconnect()
0022 except Exception as e:
0023 print("Connection failed:", type(e).__name__, e)