I want to use the SessionId of the message added to the Topic and pulled into my Azure function via a subscription.
I assign the sessionId when I place the message in the Topic. Is there a way for me to read the sessionId when my Azure function is triggered that the subscription has a new message?
This is the declaration of my Azure function ServiceBusTrigger.
[Function("GenerateListings")]
public void Run([ServiceBusTrigger("processlisting", "generate", Connection = "ServiceBusConnection", IsSessionsEnabled = true)] string mySbMsg)
{
So building on what Sean Feldman stated, it appears you do have access to all the standard properties. It also appears or is important. When I placed the sessionId before the message it did not seem to work - as shown below:
public void Run([ServiceBusTrigger("processlisting", "generate", Connection = "ServiceBusConnection", IsSessionsEnabled = true)] string sessionId, string mySbMsg)
However after looking at the order of the items in the listing that Sean posted about the standard properties -- https://github.com/Azure/azure-functions-dotnet-worker/issues/384#issuecomment-851274777 I notices that sessionId came after the message. Thus I tried the following code and it seemed to work.
public void Run([ServiceBusTrigger("processlisting", "generate", Connection = "ServiceBusConnection", IsSessionsEnabled = true)] string mySbMsg, string sessionId)
I will continue testing but so far this seems to work.