I have enabled the session for subscription and also i have passed the SessionId while publishing to ESB. Based on the trigger point, Now it will hit the ServiceBusTrigger for that subscription. Here I need to consume the message without **Message Receiver**.
Can I use the **IMessageSession** as like the code below ?
public async Task MethodName([ServiceBusTrigger("Topic", "Subscription",IsSessionsEnabled =true)] Message message, IMessageSession messageSession, ILogger logger)
{
var brokeredMessage = message.Wrap(messageSession);
//download the message from dataUrl and implement business logic with the message consumed
}
OR Is there any other way or best practice to do the same ?
**My goal will be like,
Session A has 3 message in service bus.
Session B has 3 message in service bus.
Session C has 3 message in service bus.**
I need to consume / run all the Session A , Session B , Session C in parallel and it should execute in FIFO manner to read the message in each session.
This is working as expected. But **Getting the exception below, How can i handle this ?**
Exception occured while processing in The session lock has expired on the MessageSession. Accept a new MessageSession.Base Expection .