Azure service bus with session enabled integration with durable function

kk 41 Reputation points
2022-05-29T21:27:12.923+00:00

I have one service queue with session enabled.
I want to process all the messages which shares the same session id in one go every 8 hour and create a new message after aggregating all the messages from the session virtual queue and push this message to a new service queue.
The message will be processed by a new Azure durable function(using durable function as this is a long running process).

  1. How Azure function will process all the messages of a particular session in one go to create a new message?
    206486-lkg-new-hld.jpg
  1. I want to complete the messages once all the processing of messages are done. How to do that?
  2. How to complete message from the durable function?
  3. If client function calls orchestrator function and completes, the lock will be released and the message will be visible to other instance of client function but it is currently being processed by orchestrator function. How to make sure the message is not visible to other client function as it is in processed state?
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,207 questions
0 comments No comments
{count} votes

Accepted answer
  1. MughundhanRaveendran-MSFT 12,411 Reputation points
    2022-05-30T14:07:23.487+00:00

    Hi @kk ,

    Thanks for reaching out to Q&A.

    Here are the answers to the questions,

    • How Azure function will process all the messages of a particular session in one go to create a new message? Azure Functions gets triggered as soon as there is a message pushed into the Service bus queue. The function is a subscriber and it gets triggered immediately. By enabling batching, you can process multiple messages in one go. However you wont be able to trigger the service bus function on a periodic/schedule basis. Even if you create a timer trigger function, the service bus input binding wont be available, you will have to use the service bus SDK.
    • I want to complete the messages once all the processing of messages are done. How to do that? You can set the autocomplete attribute to true in the host.json file so that the messages are autocompleted once the messages are processed by the function. Please refer to this article, if you would like to set the autocomplete to individual functions.
    • How to complete message from the durable function? The above answer can be applied to durable functions as well.
    • If client function calls orchestrator function and completes, the lock will be released and the message will be visible to other instance of client function but it is currently being processed by orchestrator function. How to make sure the message is not visible to other client function as it is in processed state? Please note that the Functions runtime receives a message in PeekLock mode. Once the starter function (that gets triggered due to the service bus message) calls the orchestrator, the orchestrator will call activity functions. During this time, the function will still hold the lock and it will complete/abandon based on the corresponding execution result of the function (success/failure). So the message will not be visible for other starter function to process.

    I hope this helps. Feel free to reach out to me if you have any queries or concerns.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful