#Function [ServiceBusOutput] Binding.

1 messages · Page 1 of 1 (latest)

neon raptor
#

I have a pretty simple Function in progress using Service Bus Trigger to trigger the function. I'm attempting to take in a service bus message, do some processing based on the message attributes, then return a new message back to a different topic in my service bus. I've got the function receiving the message from the Topic currently. I've set up the output annotation, and configured the function to return a Service Bus Message, however it doesnt appear that it is sending on the topic. My connection string has read, write and manage permissions, im unsure what the issue is. I see github issues raised on this topic, but i have not been able to find a resolution yet. Basic code snip below to look at, mostly the boilerplate code from VS.

Thanks in advance!

        [Function(nameof(Function1))]
        [ServiceBusOutput("configupdates",Connection ="ServiceBus")]
        public async Task<ServiceBusMessage> Run(
            [ServiceBusTrigger("configupdates", "Requests", Connection = "ServiceBus")]
            ServiceBusReceivedMessage message,
            ServiceBusMessageActions messageActions)
        {
            _logger.LogInformation("Message ID: {id}", message.MessageId);
            _logger.LogInformation("Message Body: {body}", message.Body);
            _logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);

             // Complete the message
            await messageActions.CompleteMessageAsync(message);

            return new();
        }


sweet tusk
#

Are you getting any error messages?

neon raptor
#

i am not, and thats another weird thing lol

neon raptor
#

I put a series of breakpoints in and checked the object state at various points, and it looks as expected. I also just tried having the Function send the same message to the same Topic (should generate an infinite loop), and i only have a single trigger off the function. So we can for sure point at the output binding as the issue for the moment.

sweet tusk
#

What do your metrics for your ASB look like? Are you seeing incoming and outgoing message counts?

neon raptor
#

i see the initial message in and out of the ASB but nothing from the Function being sent back into the ASB

sweet tusk
#

Are there any Function invocations logged?

neon raptor
#

The first invocation is logged, the one that is triggered from the initial message being sent

sweet tusk
#

So...
ASB -> FA (works)
FA -> ASB (doesn't work)
ASB -> FA (?)

#

Do you have duplicate detection set on your topic/queue?

neon raptor
#

WPF app -> ASB (works)
ASB -> FA (works)
FA -> ASB (doesn't work)
this should be the end of the chain as far as Azure Services is concerned.

The message should sit in the final ASB until an onsite consumer receives the message and applies logic.
there are 2 subcriptions on the Topic each with a correlation filter. the first "Requests" has a correlation filter of "= 'Request' "
the second is a test Subscription with filter "= '000' "
The flow is essential a request response flow built on ASB for multiple physical sites.

neon raptor
#

got into work today and upgraded the package, now i am getting a huge error stream

neon raptor
#

was just a null error on the boiler _logger.LogInformation(message.body). sadly didnt fix the issue, commented out and behavior returns to before

sweet tusk
# neon raptor WPF app -> ASB (works) ASB -> FA (works) FA -> ASB (doesn't work) this should b...

WPF app -> ASB (works)
ASB -> FA (works)
FA -> ASB (doesn't work)

So the FA->ASB part is done by the code you posted before right?

        [Function(nameof(Function1))]
        [ServiceBusOutput("configupdates",Connection ="ServiceBus")]
        public async Task<ServiceBusMessage> Run(
            [ServiceBusTrigger("configupdates", "Requests", Connection = "ServiceBus")]
            ServiceBusReceivedMessage message,
            ServiceBusMessageActions messageActions)
        {
            _logger.LogInformation("Message ID: {id}", message.MessageId);
            _logger.LogInformation("Message Body: {body}", message.Body);
            _logger.LogInformation("Message Content-Type: {contentType}", message.ContentType);

             // Complete the message
            await messageActions.CompleteMessageAsync(message);

            return new();
        }
#

My suggestion is to check if you have duplicate detection enabled. If so, either disable it, or change the message.MessageID property before resending it.

neon raptor
# sweet tusk > WPF app -> ASB (works) > ASB -> FA (works) > FA -> ASB (doesn't work) So the...

correct, I do have duplicate message detection enabled, however im creating a new message before returning from the function so one would think that the message ID would be different correct? If i inspect the objects, the return message has no messageID (Null) ive never had to set a messageID prior. Ill also note that the code i sent is from the microsoft how to (link below).

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus-output?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cextensionv5&pivots=programming-language-csharp

Learn to send Azure Service Bus messages from Azure Functions.

sweet tusk
# neon raptor correct, I do have duplicate message detection enabled, however im creating a ne...

If you don't set a message ID, it is set by the SDK. I'm not sure how you're creating the new message but if you're using the old message to create the new one it is possible that you are creating the new one with the same message ID.

Duplicate detection works by checking for message ID's that have been recieved within a specified amount of time (default 10m) and duplicates are rejected. ONLY message ID is checked.

neon raptor
#

i manually set the message id to a GUID and the same results. In the creation of the new message i am only using the ReplyTo property from the original message.

#

i also tried setting the messageID to a string ("TEST"), same behavior

sweet tusk
#

Okay, so we can rule that out. Do you have application insights logging on your FA? I'm curious if there are any special HTTP response codes being returned

neon raptor
#

just the default that comes with VS i havent wired everything up yet

sweet tusk
#

You'll want to set that up, since it's very likely there is something that is being missed in those logs.

neon raptor
#

this is what i get from the dotnet panel

sweet tusk
#

Additionally, what version of the Function Service Bus Trigger are you using?

#

Try running it with the --verbose flag as suggested

#

Trying to see what the HTTP response from the SB send comes out to

neon raptor
sweet tusk
neon raptor
#

lol gotta check right? I updated the packages before i sent the first help request just to be safe lol

sweet tusk
#

There are so many people using SDK versions that are >5y old

neon raptor
#

oof, ive never tried running multiple startup projects using the command line, how would i do that?

#

ive got the function app running locally, and a wpf application that sends the initial message that both need to run

sweet tusk
#

You should be open to open another instance of command prompt or terminal

neon raptor
#

thought so

#

function says missing host endpoint information

#

ok got verbose up and running

#

same output, nothing additional. Got a lot of startup output to look at though

sweet tusk
#

Seems like your messages are being sent successfully (based on the 200 response in the screenshot) but it's not making it into the SB itself.
You may want to check the endpoint to ensure you have the right SB in mind, just in case it's sending somewhere else.
If not, then you'll likely need to open a support case since I would not have any access to logs for your resource here and they would be able to look at that.

neon raptor
#

im using the same connection string that the trigger is set to use, is this correct?

sweet tusk
#

If you're using the same connection string then it should be sending to the same location

neon raptor
#

yeah im using the Primary Key from the service bus settings -> shared access policy

sweet tusk
#

When you open the support case, to get ahead of things, make sure you provide:

  • your SDK and version (what you sent me)
  • your entity name (the topic/queue)
  • the SB namespace name (should be automatic really)
  • the screenshot (would help)
  • and mention that we troubleshooted duplicate detection
neon raptor
#

and just to make sure i open it in the right place, where is the best place to open the support ticket?

sweet tusk
#

They'll likely open up a collab to Function Apps who will likely recommend you to have app insights enabled for logging, so you should do that ahead of time.

sweet tusk
neon raptor
sweet tusk
#

Support Path, if you can select it, should be:
Azure > Service Bus > Problem sending or receiving messages

neon raptor
#

Thank you again!