🎄 Happy Holidays! 🥳
Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.
Happy Holidays!
Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.
SEMP : Can I get messages from a Queue or a topic with curl?
How do I get the actual messages from a Queue or a topic with the SEMP API?
I used the SEMP (Action) documentation https://docs.solace.com/API-Developer-Online-Ref-Documentation/swagger-ui/action/index.html#/queue/getMsgVpnQueueMsgs
and used this GET command to get messages from a queue. curl -X GET -u user:password {url:943/SEMP/v2/config/msgVpns/{msgVpnName}/queues/{queueName}/msgs
to get a list of Queue Message objects, but it didn't work.
The error message says:
msgs { "meta":{ "error":{ "code":535, "description":"No paths found for /msgVpns/my_msg_vpn/queues/testQueue/msgs", "status":"INVALID_PATH" },.............
Comments
-
@Qais, you're calling the config API but you need to call the monitor API:
Not:
SEMP/v2/config/msgVpns/{msgVpnName}/queues/{queueName}/msgs
But:
SEMP/v2/monitor/msgVpns/{msgVpnName}/queues/{queueName}/msgsThis should give you something like:
"data":[
{
"attachmentSize":331,
"contentSize":0,
...1 -
Hi @Qais,
Also note that SEMP is our RESTful management API for things like configuration and monitoring. If you are trying to actually consume the messages you'll want to use one of our messaging APIs of which there are several options that can be explored here. You can not consume messages using a HTTP GET at this time.1 -
Here is a tutorial on how to use REST API to publish/subscribe to messages:
https://solace.com/samples/solace-samples-rest-messaging/publish-subscribe/2 -
Hi @Qais , there is one thing to note with SEMP. It is explicitly a management API. It has different credentials to messaging APIs, including the REST API that @himanshu pointed you to. As a matter of policy we don't allow admin users to view messages (i,e, by issuing SEMP calls to get messages from a queue) because that breaks the role based access controls we have in place to ensure only those authorised can view messages. Long story short:
- can I use SEMP to get messages? No
- can I use REST to get messages? Yes!
0 -
Just for completeness... you can use REST to get messages off a queue. Just not with GET. But you can configure the broker to POST or PUT messages in a queue to any URL... a webhook. So you can't use curl for that (as curl is a client), but any web server or service that can accept incoming REST POSTs and PUTs could drain messages from a Solace queue.
1