#Function app interact with service bus when in a service bus trigger

1 messages · Page 1 of 1 (latest)

flint marten
#

Hey, all - thanks in advance for your help!

I'm an experienced JavaScript/node developer, but very noob with Azure.

I have a function app built which is bound to a service bus trigger, rather than subscribing to the service bus. One of the reasons I'm taking this approach is that I hope to bind the same code to an HTTP trigger and use the same code for both REST api calls and asynchronous fire-and-forget service bus calls.

Some of the messages being processed are "catastrophic" errors and shouldn't ever be retried.

How do I tell the service bus listener that's triggering my app to dead-letter this message instead of retrying it?

shut yarrow
#

Either change the MaxDeliveryCount value on the subscription to 1 or handle the dead lettering in your code

#

(via the SDK, sorry I don't know about specific JS/Node)

flint marten
#

That doesn't help, really ... sometimes I do want multiple deliveries.

For example, the request is "create account" but the account already exists. There's no reason to retry that particular message.

But if the problem is that the database is offline for a bit, I do want an automatic retry.

shut yarrow
#

That should be handled in code

#

Also, if your database is offline, you want to reschedule the message with a delay

#

(because if you immediately retry, it will most of the time fail again for the same reason)

flint marten
#

Yep. Or maybe in the response to the trigger.

#

A back-off algorithm will take care of the immediate retry concern

shut yarrow
#

Also if I understand correctly, you're talking about messages you wouldn't want read by your function in the first place, right ?

flint marten
#

Right. It should be delivered to the app by an external mechanism (trigger binding)

shut yarrow
#

I'm not really following

flint marten
shut yarrow
#

You can't really decouple with SB if you want to have proper error handling

quiet mauve
#

If you want more decoupling you might want to look at even driven

flint marten
#

@quiet mauve - got a web page I can look at?

quiet mauve
#

No

flint marten
#

'k - thanks. Event drive architecture is a part of what I'm working toward.