Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServiceBus Session support #16

Open
Zenuka opened this issue Jun 12, 2015 · 104 comments

Comments

@Zenuka
Copy link

commented Jun 12, 2015

I've posted this question yesterday on StackOverflow but I guess this is a better place to ask; is it possible to have something like ServiceBusSessionTrigger for handling session through the webjobs sdk?

@mathewc

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2015

Can you detail more on the scenarios you're thinking of for it, and how you'd like it to work? The new extensibility model we're opening up would allow you to write one yourself if you wanted to. However, if this is something that many people would find useful, it would make sense for us to bake into our core ServiceBus assembly.

It's not clear to me whether this would need to be a completely new trigger binding, or whether on the trigger/receive side of things it couldn't just be an additional mode on the existing ServiceBusTrigger binding. Behind the scenes, it polls for and accepts sessions, and invokes your job function for session messages.

As far as sending session based messages, I think our ServiceBus binding (e.g. used when sending a BrokeredMessage via out param binding) would work as is? You just set your session ID on the message before sending.

@Zenuka

This comment has been minimized.

Copy link
Author

commented Jun 15, 2015

I'm going to use it for handling the messages of one session in a specific sequence and preferably multiple sessions at once. Since it's currently not possible, I'm going to use this article to process multiple sessions per webjob.
How should it work? Good question... I think it would be nice to have a method something like this:

public static void ProcessQueueMessages([ServiceBusTrigger(queueName:"inputqueue", useSessions: true)] List<string> messages) { ... }

Or whatever type of object you expect. Also you would need to specify somewhere in the config the timeout between sessions; after how many (milli)seconds will you assume the session is finished?

And you are correct, for sending messages you just need to set something in the SessionId.

@JasonBSteele

This comment has been minimized.

Copy link

commented Jan 31, 2016

I'd love to see this feature as well. I need my inbound messages to be in a guaranteed delivery order, and it seems using the Service Bus Session is the way to do this. However it is not at all clear how I would implement this in a WebJob.

@isaacabraham

This comment has been minimized.

Copy link

commented Mar 12, 2016

@mathewc

Not having this is a blocker for me currently. We're using queues + the webjobs SDK as a very lightweight, scalable reactive work item list - messages come on, and processing those messages leads to 0 .. M new messages going back onto the queue. When we need to have guaranteed sequential processing - almost simulating an actor-style model - service bus sessions is the only option. This is crucial if we have some critical region of data processing and don't want e.g. transactions on SQL database (or can't e.g. Azure blobs).

Having an easy way to target messages on a specific session and have them work transparently within webjobs would be a huge benefit and would open a ton of possibilities. So on the input side I would love to see it "just work": -

  • Web job trigger has an extra argument to indicate if you want to bind to sessions or just plain messages
  • A session is bound to a specific web job process + thread instance and stays with it until the session dries up
  • Optionally an extra input argument for the name of the session that has been bound to the function call
  • On the output, it would be great if you could specify the session name on the ServiceBus attribute somehow, but this isn't as much of an issue as there's already a way to do this via BrokeredMessage directly as you say.
@MikeYeager

This comment has been minimized.

Copy link

commented Apr 7, 2016

I need this feature as well. We have a WebAPI call that's taking longer and longer as we add more work to each call. When it started to timeout in Azure, we decided to move the process into a WebJob so that clients can initiate the task, then check back to get progress. The clients in this case are browsers making AJAX calls. If we can't correlate the requests with the responses, they can't check on progress or completion of the WebJob. We started looking at Azure Storage Queues, but found that there's no way for the original caller to only receive responses intended for them. We can't create a response queue for each client, because each client is a browser. We saw that Service Bus Queues and Topics allow us to use the SessionId to correlate requests and responses. The client (browser) can filter the response queue to only see responses intended for them. It sounded like a perfect solution. After wrestling with configuration we got the JobHost.RunAndBlock() to almost run, but we get the following error:

It is not possible for an entity that requires sessions to create a non-sessionful message receiver.

We found this documentation at http://www.cloudcasts.net/devguide/Default.aspx?id=13029

If sessions are required on a queue it is not possible to use the QueueClient Receive method to dequeue messages. Attempting to do so will result in.

InvalidOperationException

It is not possible for an entity that requires sessions to create a non-sessionful message receiver.

We assume the WebJobs SDK is using the QueueClient Receive method. We're going to try to work around this by having the request queue send a Guid as part of the payload and not require Sessions on the request queue. We'll require sessions on the response queue and see if we can use the Guid in the payload as the SessionId for the response. Will let you know if that works.

@isaacabraham

This comment has been minimized.

Copy link

commented Apr 12, 2016

One thing I've noticed since my OP is that you can use [<Singleton>] on e.g. a Storage Queue and use the SingletonScope to achieve virtually the same thing (as far as I can see) as Service Bus sessions. Can anyone confirm that?

@MikeYeager

This comment has been minimized.

Copy link

commented Apr 13, 2016

FYI, the work-around mentioned above worked perfectly:
"having the request queue send a Guid as part of the payload and not requiring Sessions on the request queue. We'll require sessions on the response queue and use the Guid in the payload as the SessionId for the response."

@Hihaj

This comment has been minimized.

Copy link

commented May 6, 2016

I would really like to see this implemented as well. I don't use the WebJobs SDK directly that much, but if I understand it correctly this would allow for Azure Functions written in for example JavaScript to handle message sessions (something that's not supported in the Node.js Azure SDK since it uses the REST interface of Azure Service Bus).

@Bigshooter

This comment has been minimized.

Copy link

commented Jun 6, 2017

Was there any traction on this?

@benjamineberle

This comment has been minimized.

Copy link

commented Aug 25, 2017

+1
Our requirement is FIFO by tenant in a multi-tenant system. In this case data imports via upsert

@brettsam

This comment has been minimized.

Copy link
Member

commented Sep 26, 2017

@amit-kumar2 -- is this the issue that you brought up to me yesterday? If so, would you want to weigh in with your scenario here so we have it captured?

@appalaraju

This comment has been minimized.

Copy link

commented May 11, 2018

HI,

i am using below code with Servicebus and Topic-Subscription with session enabled

public static void ProcessTopicMessage([ServiceBusTrigger("%ServicebusTopic%", "%ServicebusSubscription%")] BrokeredMessage message, TextWriter logger)
{
}

but the problem i face with continuously running web job is host.RunAndBlock(); throws below error so how to resolve this issue? Azure web job does not support Session enabled topic-subscription?

An unhandled exception of type 'System.InvalidOperationException' occurred in mscorlib.dll

Additional information: It is not possible for an entity that requires sessions to create a non-sessionful message receiver. TrackingId:074fbc74-b5e9-4fc2-886b-ed2f4e324304_G5_B15, SystemTracker:az-g3ms-servicebus:Topic:az-rsd-dev-topic|az-rsd-dev-subscription, Timestamp:5/11/2018 5:16:14 AM

@raulbojalil

This comment has been minimized.

Copy link

commented Jun 15, 2018

Hi @appalaraju were you able to resolve your issue?. In my case I'm not getting any exceptions, but the web job is not being fired either. If I disable sessions in my queue the web job starts working again.

@MikeYeager

This comment has been minimized.

Copy link

commented Jun 15, 2018

As far as we have been able to determine, we simply have to accept that the queue will throw exceptions on occasion with no discern-able reason so we just have to handle and ignore it. As far as not working when sessions are enabled, we have not encountered that. Have you tried turning on diagnostics in the portal?

@mathewc

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2018

Related to background errors coming from MessageReceivers - we just made some improvements in that area: Azure/azure-webjobs-sdk#1703

@appalaraju

This comment has been minimized.

Copy link

commented Jun 16, 2018

Hi @raulbojalil,MikeYeager

Have you tried with Topic + Session enabled Subscription?

in my case, i have created a web job and used the code(ProcessTopicMessage) which i specified above with Topic and session enabled subscription and ran it locally( in my machine).

i am facing the issue which i specified above.

any idea on when can Azure web job works properly with Topic + Session enabled Subscription?

@JohannesHoppe

This comment has been minimized.

Copy link

commented Aug 5, 2018

Warning: This horse is dead 🐴!

You need to process your messages in FIFO style? Better use some other technology and stop waiting for Microsoft to support their own technology stack!

@ridhoq

This comment has been minimized.

Copy link

commented Aug 18, 2018

If Microsoft cannot prioritize this, would anybody else be interested in attempting to put together a PR for this? I am not sure I can do it alone, but I'm happy to take a stab at it.

@davidrevoledo

This comment has been minimized.

Copy link

commented Sep 20, 2018

It'd be good to have this feature :(

@JasonBSteele

This comment has been minimized.

Copy link

commented Sep 21, 2018

So it's been over 2 years since this issue was raised and still nothing on whether/when this will be addressed.

Please vote for it at https://feedback.azure.com/forums/355860-azure-functions/suggestions/13882992-support-for-session-enabled-azure-service-bus-queu

@davidrevoledo

This comment has been minimized.

Copy link

commented Nov 5, 2018

This is a limitation for us, any eta to implement this ?

@davidrevoledo

This comment has been minimized.

Copy link

commented Nov 5, 2018

@ridhoq If you want I join the community support for this

@JasonBSteele

This comment has been minimized.

Copy link

commented Nov 6, 2018

On October 18th 2018 a comment was added to https://feedback.azure.com/forums/355860-azure-functions/suggestions/13882992-support-for-session-enabled-azure-service-bus-queu to say the work has been planned... so there is hope!

@fabiocav

This comment has been minimized.

Copy link
Member

commented Mar 5, 2019

Assigning this to sprint 45 for initial design and scoping

@brettsam

This comment has been minimized.

Copy link
Member

commented Apr 3, 2019

Design is ready for internal review. Will be reviewing and planning in Sprint 47. When finalized, we'll respond back here.

@fabiocav

This comment has been minimized.

Copy link
Member

commented Apr 17, 2019

Design work completed. Moving this to sprint 48 to track the implementation

@alrod

This comment has been minimized.

Copy link
Contributor

commented Apr 26, 2019

Pre-release nuget package is out. Change Microsoft.Azure.WebJobs.Extensions.ServiceBus nuget package in your VS project if you want to try to:
https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/3.1.0-beta1

Using:
public static void Run([ServiceBusTrigger("core-test-queue1-sessions", Connection = "AzureWebJobsServiceBus", IsSessionsEnabled = true)]string myQueueItem, ClientEntity clientEntity, ILogger log)

IsSessionsEnabled = true - if you are pointed to a sessions enabled queue/subscription.
ClientEntity clientEntity - for management operations (like MessageReceiver for a regular queue/subscription).

Also you can specify new SessionHandlerOptions section in host.json:

{
    "version": "2.0",
    "extensions": {
        "serviceBus": {
            "SessionHandlerOptions":
             {
                "MaxAutoRenewDuration": "00:01:00",
                "MessageWaitTimeout": "00:05:00",
                "MaxConcurrentSessions": 16,
                "AutoComplete": true,
             }
        }
    }
}

I'll appreciate for any feedback.

@fabiocav

This comment has been minimized.

Copy link
Member

commented May 1, 2019

Moving this to sprint 49 to allow more time for feedback before this work is merged.

@appalaraju

This comment has been minimized.

Copy link

commented May 2, 2019

Is this feature available in Azure functions?

@appalaraju

This comment has been minimized.

Copy link

commented May 24, 2019

@appalaraju your project is targeting .NET Framework 4.6.1. You need to create a .NET Core 2.2 project.

@alrod , Thanks for your valuable information. i will try and reach you.

@ahocquet

This comment has been minimized.

Copy link

commented May 30, 2019

I've tried the 3.1.0-beta2 nuget package but I'm having the following error :

A host error has occurred
Microsoft.Azure.WebJobs.ServiceBus: Index was outside the bounds of the array.

I have the following configuration:

  • Visual Studio 2019 V16.1.1
  • .NET Core 2.2 Project
  • Microsoft.NET.Sdk.Functions v1.0.27

I've uploaded my project to this repo : https://github.com/ahocquet/azure-function-service-bus-session

Some screenshots:

@emi662002

This comment has been minimized.

Copy link

commented Jun 2, 2019

I'm using functions v2, with IsSessionsEnabled=true
I have a Topic+Subscription with session enabled
But my function is not triggering.
It does trigger when I use a topic+subsription with session disabled and IsSessionDIsabled=false.

VS2019
Microsoft.Azure.WebJobs.Extensions.ServiceBus 3.1.0-beta2
.net core 2.2
sdk functions 1.0.28

@jeffhollan

This comment has been minimized.

Copy link
Member

commented Jun 2, 2019

@emi662002

This comment has been minimized.

Copy link

commented Jun 2, 2019

@jeffhollan

This comment has been minimized.

Copy link
Member

commented Jun 2, 2019

Hmm not sure on this. Do you see any errors being thrown or does it just not trigger?

@emi662002

This comment has been minimized.

Copy link

commented Jun 3, 2019

Hmm not sure on this. Do you see any errors being thrown or does it just not trigger?

it just won't trigger. I don't get any errors, the other functions on my solution trigger just ok (those are not session enabled)
@jeffhollan I've followed your example solution but this one is with queues, and not topic+subscription. would this be the problem? I know with t+s you have queues, but it's not the same trigger configuration....

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

Hmm not sure on this. Do you see any errors being thrown or does it just not trigger?

it just won't trigger. I don't get any errors, the other functions on my solution trigger just ok (those are not session enabled)
@jeffhollan I've followed your example solution but this one is with queues, and not topic+subscription. would this be the problem? I know with t+s you have queues, but it's not the same trigger configuration....

@emi662002, can you please share your project with the no-working trigger? or can you please post the definition of your trigger?

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

I've tried the 3.1.0-beta2 nuget package but I'm having the following error :

A host error has occurred
Microsoft.Azure.WebJobs.ServiceBus: Index was outside the bounds of the array.

I have the following configuration:

  • Visual Studio 2019 V16.1.1
  • .NET Core 2.2 Project
  • Microsoft.NET.Sdk.Functions v1.0.27

I've uploaded my project to this repo : https://github.com/ahocquet/azure-function-service-bus-session

Some screenshots:

@ahocquet, I have identified the bug: session trigger does not work when queue name contains "/". It will be fixed in next beta version.

@emi662002

This comment has been minimized.

Copy link

commented Jun 3, 2019

Hmm not sure on this. Do you see any errors being thrown or does it just not trigger?

it just won't trigger. I don't get any errors, the other functions on my solution trigger just ok (those are not session enabled)
@jeffhollan I've followed your example solution but this one is with queues, and not topic+subscription. would this be the problem? I know with t+s you have queues, but it's not the same trigger configuration....

@emi662002, can you please share your project with the no-working trigger? or can you please post the definition of your trigger?

[FunctionName(nameof(OrderedFunction))]
public static async Task Run([ServiceBusTrigger("orderedtopic",
"orderedbread", Connection = "ReadConnection",IsSessionsEnabled = true)]string mySbMsg,
ILogger log)

let me know if you need something else, and thanks 👍

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

@emi662002, your trigger definition looks good. I tested the same trigger definition and it works for me.
Are you testing locally or in Azure?
Can you please share your function name if you test in Azure:
https://github.com/Azure/azure-functions-host/wiki/Sharing-Your-Function-App-name-privately

@emi662002

This comment has been minimized.

Copy link

commented Jun 3, 2019

@emi662002, your trigger definition looks good. I tested the same trigger definition and it works for me.
Are you testing locally or in Azure?
Can you please share your function name if you test in Azure:
https://github.com/Azure/azure-functions-host/wiki/Sharing-Your-Function-App-name-privately

2019-06-03T19:45:31.658 [Information] Executing 'OrderedFunction' (Reason='This function was programmatically called via the host APIs.', Id=f2d835cc-f00d-4a13-ba7e-94dcf0a7503e)
West Europe.

Locally and on Azure both are not triggering. On azure when I run according to your link I see a null pointer exception.

edit:

On Azure it seems to run but to show a null pointer due to own code (but I'm pretty sure this does work, I use it on another functions).

Locally I dont ever hit a breakpoint on the Run method. So my code is never reached.

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jun 3, 2019

@emi662002
Azure:

  1. Your function is triggered on Azure as you see in the logs:
    [Information] Executing 'OrderedFunction' (Reason='This function was programmatically called via the host APIs.', Id=f2d835cc-f00d-4a13-ba7e-94dcf0a7503e)
  2. You got an unhandled "System.NullReferenceException" in your function code:
   at async AppCuesWorker.CosmosRepo.Insert(Bread pew,ILogger log) at D:\agent\_work\453\s\AppCuesWorker\CosmosRepo.cs : 22
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async AppCuesWorker.OrderedFunction.Run(String mySbMsg,ILogger log,ISample sample) at D:\agent\_work\453\s\AppCuesWorker\OrderedFunction.cs : 28

Locally:
It is possible the SB message is triggered by the function on Azure so local function does not trigger if you have both up and running in the same time.
If it's not the case please compare "ReadConnection" setting locally and on Azure.

@emi662002

This comment has been minimized.

Copy link

commented Jun 4, 2019

@emi662002
Azure:

  1. Your function is triggered on Azure as you see in the logs:
    [Information] Executing 'OrderedFunction' (Reason='This function was programmatically called via the host APIs.', Id=f2d835cc-f00d-4a13-ba7e-94dcf0a7503e)
  2. You got an unhandled "System.NullReferenceException" in your function code:
   at async AppCuesWorker.CosmosRepo.Insert(Bread pew,ILogger log) at D:\agent\_work\453\s\AppCuesWorker\CosmosRepo.cs : 22
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async AppCuesWorker.OrderedFunction.Run(String mySbMsg,ILogger log,ISample sample) at D:\agent\_work\453\s\AppCuesWorker\OrderedFunction.cs : 28

Locally:
It is possible the SB message is triggered by the function on Azure so local function does not trigger if you have both up and running in the same time.
If it's not the case please compare "ReadConnection" setting locally and on Azure.

@alrod When i test locally, I disable the function on azure. Strange thing is that my breakpoint is never hit.

The null pointer on Azure seems to come from an empty string message when the function is invoked. Because I deserialize it and then use the object that nulled is.

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2019

@ahocquet,
https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/3.1.0-beta3 is out.
"Session trigger does not work if queue name contains '/' " is fixed this package.

@ahocquet

This comment has been minimized.

Copy link

commented Jun 7, 2019

@alrod

Thanks for the update! Unfortunately, it seems broken at the moment as it tries to download Microsoft.Azure.Webjobs 3.0.9 that is still not available on nuget.

image

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

@ahocquet, just pushed 3.0.9 to nuget. thanks!

@ahocquet

This comment has been minimized.

Copy link

commented Jun 7, 2019

That was fast, thank you! I can confirm that now it's working as expected, event when the queue has a "/" in its name. 🎉

@KyleLehtinenDev

This comment has been minimized.

Copy link

commented Jun 25, 2019

Having problems getting a sessionful message reciever setup. Have closely reviewed the discussion here but not sure where my problem is.

Getting this error message when trying to run a dotnet azure function locally with a ServiceBusTrigger (stripped identifying info):
[6/25/19 8:37:12 PM] Message processing error (Action=Receive, ClientId=MessageReceiver1XXXX, EntityPath=XXXXX, Endpoint=XXXXX.servicebus.windows.net) [6/25/19 8:37:12 PM] Microsoft.Azure.ServiceBus: It is not possible for an entity that requires sessions to create a non-sessionful message receiver. TrackingId:d6569327-0b34-48a4-a24c-0554bf7a0de9_B20, SystemTracker:XXXXX:Queue:XXXXXX, Timestamp:2019-06-25T20:37:12 TrackingId:0f6053cf61ef4455a98b90521bb58523_G15, SystemTracker:gateway7, Timestamp:2019-06-25T20:37:12.

I'm using netcore2.2, 3.1.0-beta3 of the webjobs extension, and have passed in IsSessionsEnabled = true.

My code is mainly just from getting started docs:

using System;
using Microsoft.Azure.ServiceBus;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace Company.Function
{
    public static class ServiceBusQueueTriggerCSharp
    {
        [FunctionName("ServiceBusQueueTriggerCSharp")]
        public static void Run(
          [ServiceBusTrigger("testsessionqueue", Connection = "corp-us2-apigw_SERVICEBUS", IsSessionsEnabled = true)]
            string myQueueItem, 
          IMessageSession session,
          ILogger log)
        {
            log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
        }
    }
}

"testsessionqueue" is a session queue and I created the azure function using azure function tools in VS Code. Any suggestions?

EDIT:
Made a change in .vscode/tasks.json to ensure it was pointing to the netcore2.2 build of the app. I think I had the old 2.1 path still set because of the func host code generation I used in VS Code.

I then encountered an error about being unable to bind the IMessageSession parameter. When I commented that out the code above processed messages in the queue. I then changed my sample code "session" to "messageSession" and it worked, so I guess there's a hidden binding rule and you must use the exact parameter name for the binding?

The end result is I appear to have sessionful receive clients generating and an instance of the message session to handle things with. Still seems like it's completing the messages pre-maturely but I'll keep tinkering around for now.

@tidusjar

This comment has been minimized.

Copy link

commented Jul 5, 2019

One thing that does seem to be a regression is that with 3.1.0-beta3 I can no longer use the %Variable% in the topic name, I just get the following:

Microsoft.Azure.ServiceBus: Put token failed. status-code: 404, status-description: The messaging entity 'sb://my-service-bus.servicebus.windows.net/%25AzureServiceBusTopicName%25/Subscriptions/mysub' could not be found. TrackingId:20fa196e-57f4-468d-a727-e2f6f997b208_G11, SystemTracker:my-service-bus.servicebus.windows.net:%25AzureServiceBusTopicName%25/Subscriptions/mysub, Timestamp:2019-07-05T07:20:45.

My code:

public static async Task Run([ServiceBusTrigger("%AzureServiceBusTopicName%", "mysub", Connection = "AzureServiceBusPrimary", IsSessionsEnabled = true)]
           Message message, IMessageSession messageSession, ExecutionContext executionContext, ILogger log)

As you can see when the function builds the service bus URI it is taking the %AzureServiceBusTopicName% as a literal string and there is no substitution going on.

@mpnow

This comment has been minimized.

Copy link

commented Jul 7, 2019

I then encountered an error about being unable to bind the IMessageSession parameter. When I commented that out the code above processed messages in the queue. I then changed my sample code "session" to "messageSession" and it worked

Same here - when I try any other variable name than "messageSession" I get the "unable to bind" error; using "messageSession", it works. This is with 3.1.0-beta3.

@mpnow

This comment has been minimized.

Copy link

commented Jul 9, 2019

For my own use case, I'd like to have a function that processes in parallel for different session IDs - that is, starts and runs a new instance of the function each time it encounters a different session ID in the input service bus queue, so multiple instances might be running and processing simultaneously - but operates in series for messages of the same session ID - that is, if it encounters a message of a session ID that's currently processing, it waits to start processing the queued message until the currently processing item of that session ID is done. Will this new session support work this way by default, or do I need to use the [Singleton] attribute on the function, or take another approach?

EDIT:
OK, I just re-read https://docs.microsoft.com/en-us/azure/service-bus-messaging/message-sessions and https://github.com/Azure/azure-webjobs-sdk/issues/529#issuecomment-489998900. From my reading, it sounds like if I use session IDs it will work exactly the way I described.

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jul 10, 2019

@tidusjar, @mpnow I am investigating %Variable% issue in beta3. I will update the thread. Thanks for reporting!

@alexgman

This comment has been minimized.

Copy link

commented Jul 10, 2019

If we have a servicebus-triggered function, how do we process all the messages for that specific session?

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2019

@mpnow, @KyleLehtinenDev. Regarding IMessageSession messageSession, the parameter name must have exact name messageSession as it is a trigger metadata value.

@alrod

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2019

If we have a servicebus-triggered function, how do we process all the messages for that specific session?

There is no support for filtering by sessionId using trigger parameters. What you can do:

  1. In host.json SessionHandlerOptions.AutoComplete = false
  2. In your function code:
if (message.SessionId == "value") {
// Processing logic..
messageSession.CompleteAsync(message.SystemProperties.LockToken);
}

Note the trigger will be constantly firing if the entity contains a message with sessionId != "value".

@rybczak

This comment has been minimized.

Copy link

commented Jul 25, 2019

When can we expect to have this feature released to production?

@alrod

This comment has been minimized.

Copy link
Contributor

commented Aug 5, 2019

https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/3.1.0-beta4 is out.

@tidusjar, @mpnow the issue for resolving %Variable% is fixed in beta4.
@rybczak, most likely the feature will be released in September

@alrod alrod transferred this issue from Azure/azure-webjobs-sdk Aug 5, 2019

@appalaraju

This comment has been minimized.

Copy link

commented Aug 13, 2019

Hi @alrod ,
Could you please look into it.

I have followed all steps you suggested in this post but i am unable to receive session-messages from topic-subscription.

could you please look into it. please let me know where i am doing wrong?

i am using .Net Core 2.1,Microsoft.Azure.WebJobs(3.0.10),Microsoft.Azure.WebJobs.Extensions(3.0.2),Microsoft.Azure.WebJobs.Extensions.ServiceBus(3.1.0-beta4),Microsoft.Azure.WebJobs.Extensions.Storage(3.0.3) and VS 2019

Please find the sample project attached
Core_WebJob.zip

i have created a ProcessTopicMessage method for reading messages which are not session enabled messages and this method is able to read messages from topic-subscription( sessionenabled=false)

i have created a ProcessTopicMessage method for reading messages which are session enabled messages and this method is not able to read messages from topic-subscription( sessionenabled=true)

Program.cs file has below code
program

below are the nuget packages installed
nuget

Processtopicmessage function
processtopicmessage

topic-subscription in azure portal
session-subscription

i am using below sample code to push session enabled messages to session enabled topic-subscription. is this correct way?
Client_push_messages

static string iotHubUri = "g3ces.net";
static string deviceKey = "fdfdfdsf=";
static DeviceClient deviceClient;
deviceClient = DeviceClient.Create(iotHubUri, new DeviceAuthenticationWithRegistrySymmetricKey("ae609249-19ddsfagasqd56dc945d", deviceKey));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.