Hardware Platform: GPU
Deepstream: 7.0
Docker Image: 7.0-triton-multiarch
GPU Type: A4000
I want to send the topic name via Rest. How can I do it?
Hardware Platform: GPU
Deepstream: 7.0
Docker Image: 7.0-triton-multiarch
GPU Type: A4000
I want to send the topic name via Rest. How can I do it?
which deeptream sample are you testing or referring to? could you share your use case? how did you get topic name? where do you send it to?
When the user adds a stream, I add the stream to deepstream via Rest request. My backend application decides the topic name. I want to send the detections in the stream to the Rabbitmq topic previously determined by the backend. The detections of each stream will have a different topic name.
Building a custom pipeline but it similar to deepstream-test5. In my case topic name comes from another source. That’s the only difference.
Sorry for the late reply! Currently topic is configurable in the configuration file. for example, topic: in opt\nvidia\deepstream\deepstream\sources\apps\sample_apps\deepstream-test5\configs\test5_dec_infer-resnet_tracker_sgie_tiled_display_int8.yml, this value will be passed to nvmsgbroker plugin. nvmsgbroker is opensource. you can modify the code the customize. for example, after getting the topic name, then set the value to plugin 's property.
Adding stream with this request:
curl -XPOST ‘http://localhost:9000/api/v1/stream/add’ -d ‘{
“key”: “sensor”,
“value”: {
“camera_id”: “uniqueSensorID1”,
“camera_name”: “front_door”,
“camera_url”: “file:///opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4”,
“change”: “camera_add”,
“metadata”: {
“resolution”: “1920 x1080”,
“codec”: “h264”,
“framerate”: 30
}
},
“headers”: {
“source”: “vst”,
“created_at”: “2021-06-01T14:34:13.417Z”
}
}’
Can i register camera_id to topic in config file. Want to seperate each stream with different routing key.
Need something like this. topic=data.<camera_id>. So i can seperate each stream on Rabbitmq. I am connecting many stream to one model.
are you testing deepstream-server and using multiurisrcbin?
these camera information will be save in server. please refer to s_stream_callback_impl of \opt\nvidia\deepstream\deepstream\sources\apps\sample_apps\deepstream-server\rest_server_callbacks.cpp. you can add “user event msg meta” with the camera information, then detetection inforamtion and the corresponding camera information will be sent to broker. please refer to generate_event_msg_meta in \opt\nvidia\deepstream\deepstream\sources\apps\sample_apps\deepstream-test4\deepstream_test4_app.c. especially msg2p-newapi needs to be set 0 if you want to add user event msg meta. please refer to the doc explanation.
Thank you for the reply. I will try to implement this but its challenging to implement who don’t have much experience with C++. Support for controlling [sink] group properties via Rest will super helpful for next releases.
Sorry for the late reply, Is this still an DeepStream issue to support? Thanks!
Working on deepstream-test5
with use-nvmultiurisrcbin=1
and msg2p-newapi=0
. How can I get info from rest server to set user event msg meta inside generate_event_msg_meta
?
if msg2p-newapi=0, please refer to my comment on Sep 24.
To make things clear my workflow looks like;
deepstream-test5
/ use-nvmultiurisrcbin=1
][sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=UDPSink 5=nvdrmvideosink 6=MsgConvBroker
type=6
msg-conv-payload-type=1
msg-broker-proto-lib=/opt/nvidia/deepstream/deepstream/lib/libnvds_amqp_proto.so
#Provide your msg-broker-conn-str here
msg-broker-conn-str=rabbit.app_network;5672;guest;guest
topic=data
msg-broker-comp-id=1
msg-conv-comp-id=1
#Optional:
msg-broker-config=/opt/nvidia/deepstream/deepstream/sources/libs/amqp_protocol_adaptor/cfg_amqp.txt
msg-conv-msg2p-lib=/opt/nvidia/deepstream/deepstream/lib/libnvds_msgconv.so
curl -XPOST 'http://localhost:9000/api/v1/stream/add' -d '{
"key": "sensor",
"value": {
"camera_id": "data.1234-5678",
"camera_name": "front_door",
"camera_url": "http://100.10.10.10:8090/",
"change": "camera_add",
"metadata": {
"resolution": "1920 x1080",
"codec": "h264",
"framerate": 30
}
},
"headers": {
"source": "vst",
"created_at": "2021-06-01T14:34:13.417Z"
}
}'
data
. But I want to inject camera_id(data.1234-5678
) field to nvmsgbroker plugin to update topic name before pipeline starts to send messages. So pipeline will send messages to data.1234-5678
instead of data
.Can you share detailed explanations with related code blocks. The structre is to complex. Thanks
here are the detailed steps.
serverappctx->config.sensorId = (gchar *) stream_info->value_camera_id.c_str ();
serverappctx is defined in main function. namely AppCtx.
Attached sensorId to NvDsEventMsgMeta inside bbox_generated_probe_after_analytics
[deepstream_test5_app_main.c] function then added user event meta. Now I want to change topic name. I think i should do this step inside new_gst_nvmsgbroker_render_user_meta_list
[gstnvmsgbroker.cpp] function. How can I reach sensorId i set inside this function.
nvmsgbroker is opensource. topic is a property of nvmsgbroker plugin. you can modify it by the following code.
g_object_set (G_OBJECT (bin->sink), "topic", "new name", NULL);
Should I do this inside deepstream_sink_bin.c
and how can I reach user event meta to set new topic name
please find nvds_msgapi_send_async/nvds_msgapi_send in opt\nvidia\deepstream\deepstream\sources\gst-plugins\gst-nvmsgbroker\gstnvmsgbroker.cpp. broker topic name is not part of messge payload. you can’t use “user event meta” to add. you can pass different topic name to interface function. please refer to my last comment for how to modify the name. gstnvmsgbroker.cpp is opensource. you can also modify the code to customize.
Followed your instructions but now you say
How can I get camera_id value saved to serverappctx
to set new topic name inside gstnvmsgbroker.cpp
we need to pass topic name and payload to low-level function. payload string can include topic name item. Here are two cases.
case1: topic name is not a part of message payload. you want to pass new topic name to low-level function nvds_msgapi_send_async/nvds_msgapi_send. In this case, topic is a property of nvmsgbroker plugin. please refer to my comment on Oct 18.
case2: topic name is a part of message payload, which is a Json string, In this case, please refer to my comment on Oct 15. and please refer to this topic.
My situation is case 1
How can I pass value saved on serverappctx to nvds_msgapi_send_async/nvds_msgapi_send functions?
nvmultiurisrcbin->config->sensorName =
(gchar *) stream_info->value_camera_name.c_str ();
as the code shown, take camera id for example, camera name will saved in nvmultiurisrcbin->config->sensorName. please refer to GstDsNvUriSrcConfig in \opt\nvidia\deepstream\deepstream\sources\includes\gst-nvdscommonconfig.h, GstDsNvUriSrcConfig does not include “topic name” item, but gstdsnvmultiurisrcbin is opensource. you can modify it to cusotmize. then you can access nvmultiurisrcbin in test5 by this code “pipeline->multi_src_bin.nvmultiurisrcbin”. then you can get the saved data from nvmultiurisrcbin and set the data to nvmsgborker plugin by the method on Oct 18.