none
Peek and Complete a message from Different Receiver Instances RRS feed

  • Question

  • Scenario

    When business transactions are performed, we're supposed to make that data available to end clients.

    Current Design

    Our web app publishes messages to the Service Bus, so the transaction are added to a topic.

    We expose APIs to clients through which they can consume the data from those transactions.

    Upon calling these APIs, we read the messages from the Subscription and return it to the client.

    Problem

    We want a guaranteed delivery - we want to make sure the client acknowledges the delivery of the data. So we don't want to remove the message from the subscription immediately. We want to keep it until the client acknowledges it.

    So we only want to do a "Peek" instead of "Receive".

    So the client calls the first API, to get the data, where we do a Peek.

    And once the client has received the packets, the client would call a second API, to acknowledge.
    At this point, we want to remove the message from the Subscription, making it Complete.

    The current design of the Service Bus Message Receiver is that, a Complete can be performed only using the same Receiver instance that performed the Peek, as per the documentation, and we also observed the same when we tried it out.

    Both the APIs, are two separate APIs and we cannot do the Peek and Complete using the same instance of the Receiver.

    Thinking about options to somehow make the Receiver as a Singleton, across APIs within that App Service.
    However this will be a problem when the App Service scales out.

    Is there a different way to achieve what we're trying to do here ?



    Friday, November 8, 2019 9:15 PM

All replies

  • Another option would be to not use a Service Bus Client on your backend and instead your clients could directly work with Service Bus using its Service REST API (assuming they can't use the AMQP client if I am understanding your scenario correctly).

    There are APIs to

    You could also proxy these requests if you'd like using your backend itself or a service like APIM if you are already using it.


    Monday, November 11, 2019 4:28 AM
    Moderator
  • I did consider this as an option, was wondering about how we secure this when exposing this outside to customers. We do use APIM to expose our APIs to customers, so it's great to know that the Service Bus REST API endpoints can be proxied and routed through APIM. I will need to explore further on that. If you have any references towards applying a proxy to access the Service Bus REST endpoints, through APIM that would be great. I'll look around too.
    Does the PeekLock REST API have a batch capability ? I couldn't find one in the reference.

    Thank you for the response.

    Wednesday, November 13, 2019 9:32 PM