11
votes

I know it's possible to recieve messages from a service bus queue like:

public static void ProcessQueueMessage([ServiceBusTrigger("inputqueue")] string message, TextWriter logger)

But is there also a way to to receive a session via a trigger attribute? Something like ServiceBusSessionTrigger?

Normally one would accept a session like this:

var session = queueClient.AcceptMessageSession();

But I'd prefer the WebJob SDK to handle how multiple sessions at once can be processed.

Edit: Seems that this currently isn't supported: see github for feature request

Edit 2: Seems they are working on this

2
Hi @Zenuka, I have this problem too. Can I ask how you resolved it in the end? - Jason Steele
@JasonSteele, I don't know which blog/tutorial/video I used to implement it like 'var session = queueClient.AcceptMessageSession()' but I think you could use this as a guideline: cloudcasts.net/devguide/Default.aspx?id=13030 - Zenuka

2 Answers

1
votes

Currently you cannot receive a session via a trigger attribute, but there is a GitHub feature request. If this is something that many people would find useful, it would make sense baked into the core ServiceBus assembly.

1
votes

this nuget Microsoft.Azure.WebJobs.Extensions.ServiceBus in 3.1.0-beta3 version support session in azure function. when you install this nuget, you will be able to use it like the code below [ServiceBusTrigger("testsessionqueue", Connection = "serviceBusConnectionString", IsSessionsEnabled = true)]

there you can find nuget : Nuget and it's a github issue: github

Please bear in mind that it's still a beta