Deepstream test4 and AMQP nvmsg-broker error

Today I found my mistake. I post it in case it helps someone else.

I was missing dependencies, I skipped an important step when I compiled rabbitmq-c, to copy the built librabbitmq.so library to its final location

sudo cp librabbitmq/librabbitmq.so.4 /opt/nvidia/deepstream/deepstream-<version>/lib/


If someone wants to use rabbitmq with python (via pika), I share an receiver example that works

receive.py

#!/usr/bin/env python
import pika

credentials = pika.PlainCredentials('guest', 'guest')
connect_param = pika.ConnectionParameters(
	host='localhost',
	credentials=credentials
)
connection = pika.BlockingConnection(connect_param)

channel = connection.channel()
channel.exchange_declare(exchange='ds_exchange', exchange_type='topic', durable=False, auto_delete=True)
result = channel.queue_declare(queue='', exclusive=True)
queue_name = result.method.queue
print('qname: ', queue_name)

channel.queue_bind(exchange='ds_exchange', queue=queue_name, routing_key='ds_topic')

def callback(ch, method, properties, body):
	print(" [x] Received %r" % body)


channel.basic_consume(queue=queue_name, on_message_callback=callback, auto_ack=True)

print(' [*] Waiting for messages. To exit press CTRL+C')
channel.start_consuming()

cfg_amqp.txt

[message-broker]
password = guest
#optional
hostname = localhost
username = guest
port = 5672
exchange = ds_exchange
topic = ds_topic

Run command

python3 deepstream_test_4.py -i /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so --cfg-file cfg_amqp.txt
or (c++)
./deepstream-test4-app -i /opt/nvidia/deepstream/deepstream-4.0/samples/streams/sample_720p.h264 -p /opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_amqp_proto.so --cfg-file cfg_amqp.txt -s 0

The README file located at /opt/nvidia/deepstream/deepstream-4.0/sources/libs/amqp_protocol_adaptor was really useful for test.


To test receive.py

send.py

#!/usr/bin/env python
import pika

connection = pika.BlockingConnection( pika.ConnectionParameters(host='localhost', port=5672))

channel = connection.channel()

message = "Hello World!"
channel.basic_publish(exchange='ds_exchange', routing_key='ds_topic', body=message)

print(" [x] Sent %r" % message)
connection.close()
3 Likes