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

ServiceBusTrigger and ServiceBus outpub binding in a transaction #2207

Closed
SeanFeldman opened this issue May 15, 2019 · 7 comments
Closed

ServiceBusTrigger and ServiceBus outpub binding in a transaction #2207

SeanFeldman opened this issue May 15, 2019 · 7 comments
Assignees

Comments

@SeanFeldman
Copy link

SeanFeldman commented May 15, 2019

Azure Service Bus supports a transactional processing of an incoming message with emitting the outgoing messages using TransactionScope and Send-Via feature.

As of today (using Functions 2.0 / WebJobs 3.0) there's no way to achieve this as ServiceBusTrigger and ServiceBusAttribute used for collectors do not share the same ServiceBusConnection.

  1. Is this going to be supported?
  2. While the support for transactional messaging is not there, is there a way to get access to the receiver's connection to be used from the function to emit messages bypassing collector?
@alrod
Copy link
Member

alrod commented May 24, 2019

  1. We do not have plans to support TransactionScope.
  2. You can access MessageReceiver inside your function app code:

@alrod alrod added this to the Active Questions milestone May 24, 2019
@SeanFeldman
Copy link
Author

@alrod thank you.

Just before I close this issue, is there a documented list of things that are available for injection for Service Bus trigger? MessageReceiver is there, but if I try to inject IClientEntity, it fails. I'd rather look it up in the documentation than raise an issue each time. Thank you.

@alrod
Copy link
Member

alrod commented May 24, 2019

It looks like we do not have the full list in the docs. The only list I found is message properties:
https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#trigger---message-metadata

You can find full list here:

internal static IReadOnlyDictionary<string, object> CreateBindingData(Message value, MessageReceiver receiver, IReadOnlyDictionary<string, object> bindingDataFromValueType)

@SeanFeldman
Copy link
Author

That is peculiar. I've raised a doco issue (https://github.com/MicrosoftDocs/azure-docs/issues/32126) to point that out. Would be nice have MessageReader in the context of the output binding, but affraid the modular design will not allow it. If you have two output bindings with two different namespaces, this would not work.
Thank you @alrod.

@SeanFeldman
Copy link
Author

SeanFeldman commented May 24, 2019

You will hate me, but one more question - when using MessageReceiver to perform a transactional send from a Function, the incoming message must be completed within the transaction scope. Which is against the Functions design, assuming SDK has to complete the incoming message. It's not a biggie, but will cause the host to log a nasty exception for no good reason:

image

Is there a way to suppress it or indicated to the SDK that a function will take care of the message completion? I don't recall anything like that in the Functions doco. Need memory implants ASAP.

@alrod
Copy link
Member

alrod commented May 24, 2019

https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-service-bus#hostjson-settings
"autoComplete": false

@SeanFeldman
Copy link
Author

🤦‍♂️ Fantastic, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants