Error in the message bus with python code

Viewed 26

I have some programming related issue and I'm looking for some help.

I want to make a 'Oneview message bus' with the help of python. During the coding i use pika with rabbitmq protocol and when i run the program it always shows the 'ssl 801' error.

Code:

import string
import pika, ssl
from optparse import OptionParser
from pika.credentials import ExternalCredentials
import json
import logging

logging.basicConfig()

###############################################
# Callback function that handles messages
def callback(ch, method, properties, body):
    msg = json.loads(body)
    timestamp = msg['timestamp']
    resourceUri = msg['resourceUri']
    resource = msg['resource']
    changeType = msg['changeType']

    print
    print ("%s: Message received:" %(timestamp))
    print ("Routing Key: %s" %(method.routing_key))
    print ("Change Type: %s" %(changeType))
    print ("Resource URI: %s" %(resourceUri))
    print ("Resource: %s" %(resource))

# Parse command line options
parser = OptionParser()
parser.add_option('--host 172.16.0.210', dest='host', help='Pika server to connect to (default: %default)', default='localhost',)

options, args = parser.parse_args()
host = "172.16.0.210"

# Configure SSL options & connection parameters
context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
context.load_verify_locations("caroot.pem")
context.load_cert_chain("client.pem", "key.pem")

ssl_options = pika.SSLOptions(context, host)

conn_params = pika.ConnectionParameters(host, port=5671, credentials=ExternalCredentials(), ssl_options=ssl_options)

# Connect to RabbitMQ
print ("Connecting to %s:5671, to change use --host hostName " %(host))
connection = pika.BlockingConnection(conn_params)

# Create and bind to queue
EXCHANGE_NAME = "scmb"
ROUTING_KEY = "scmb.#"

channel = connection.channel()
result = channel.queue_declare(queue='')
queue_name = result.method.queue

channel.queue_bind(exchange=EXCHANGE_NAME, queue=queue_name, routing_key=ROUTING_KEY)
channel.basic_consume(on_message_callback=callback, queue=queue_name, auto_ack=False)

# Start listening for messages
channel.start_consuming()

I use this link:

https://techlibrary.hpe.com/docs/enterprise/servers/oneview7.1/cicf-api/en/index.html#messaging?ref=example-python

My question is that how can i deal with this error?

Thanks for your answers in advance!

Error message: enter image description here

0 Answers
Related