what is the URL pattern to send a message to Advance Event Mesh through Rest API ?

rajeshy1987113
rajeshy1987113 Member Posts: 6
edited December 2024 in PubSub+ Event Broker #1

Event Mesh URL:
POST https://domain/api/v1/queues/myQueue/messages

I tried below pattern but did not work.

POST https://<your-event-mesh-domain>/api/v1/queues/<queue-name>/messages

Tagged:

Best Answer

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 964 admin
    #2 Answer ✓

    Hi @rajeshy1987113,

    I just tested using your URL setup + body and it worked for me so that should all be good. I would suggest checking a few things:

    1. Queue names are case sensitive —> make sure they are exactly the same
    2. Make sure your authentication is correct. I used basic auth with a username/password that I got from the "Connect" menu of my service under "REST".
    3. Ensure your Queue has "Incoming" turned on
    4. Ensure your client-username has permissions to "send guaranteed messages" on it's Client Profile.

    If that doesn't work can you share what response you are getting?

    ***Something to consider depending on your user case: while there are use cases when it makes sense to publish directly to a queue, we do generally recommend publishing messages to topics and then have 1 to many queues subscribe to those topics. This allows your publishers and consumers to be more decoupled and more easily take advantage of the publish-subscribe pattern.

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 964 admin

    Hi @rajeshy1987113,

    You're close! The URL structure should look like this https://{host}:{port}/QUEUE/{queue-name} and then your body will go into the payload of the message.

    Hope that helps!

  • rajeshy1987113
    rajeshy1987113 Member Posts: 6

    thanks for responding.

    I tried same but did not work. any pre-request before sending from postman ?

    I have created a queue in my Cluster Manager→ServiceDetails → Manage →Queue —> Queue Name:Sender_Recevier_SBGTest_TestProject.

    I have given credentials which are available under Connect Tab—> REST API.

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 964 admin
    #5 Answer ✓

    Hi @rajeshy1987113,

    I just tested using your URL setup + body and it worked for me so that should all be good. I would suggest checking a few things:

    1. Queue names are case sensitive —> make sure they are exactly the same
    2. Make sure your authentication is correct. I used basic auth with a username/password that I got from the "Connect" menu of my service under "REST".
    3. Ensure your Queue has "Incoming" turned on
    4. Ensure your client-username has permissions to "send guaranteed messages" on it's Client Profile.

    If that doesn't work can you share what response you are getting?

    ***Something to consider depending on your user case: while there are use cases when it makes sense to publish directly to a queue, we do generally recommend publishing messages to topics and then have 1 to many queues subscribe to those topics. This allows your publishers and consumers to be more decoupled and more easily take advantage of the publish-subscribe pattern.

  • rajeshy1987113
    rajeshy1987113 Member Posts: 6

    Thanks Marc. Issue resolved , Issue was with permissions on it's Client Profile.

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 964 admin

    Excellent, glad to hear it @rajeshy1987113!

This Month's Leaders

This Week's Leaders