I found the test_amqp_proto_async.c file under amqp_protocol_adaptor, which is an asynchronous message queue. Now I have some problems, that is, when my MQ service stops and restarts, the asynchronous message queue does not push anymore. I want to create a reconnection mechanism now, how can I do it?
Please provide complete information as applicable to your setup.
• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)
When I want to test the /opt/Nvidia/devstream/devstream-6.2/sources/libs/amqp_protocol_adaptor/test_amqp_proto_sync.c file,I can send messages to RabbitMQ normally and see message push on the RabbitMQ management page. I now want to implement: when I stop the RabbitMQ service, the code can continuously reconnect, and when my RabbitMQ service is normal, the code can reconnect successfully and start pushing.
the approach you shared is not quite correct, proper implementation will be more involved as demonstrated in nvmsgbroker source code. The code is trying to reconnect by modifying h_ptr, but this is not going to be reflected in the app as the callback provides a copy and not a reference. The call to nvds_msgapi_connect_ptr here is also improper as it needs a connection string as so:
NvDsMsgApiHandle ah = nvds_msgapi_connect_ptr((char *) AMQP_CONNECT_STR, connect_cb, (char *) AMQP_CFG_FILE);
you need to keep track of this NvDsMsgApiHandle in the app and create a new one with which to call nvds_msgapi operations with when the connection fails.