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

feat: add servicebus sender correlation extensions #312

Conversation

stijnmoreels
Copy link
Member

Add extensions on the Azure Service Bus ServiceBusSender model to more easily send and track correlated messages that support service-to-service correlation.

Closes #309

@netlify
Copy link

netlify bot commented Jul 7, 2022

Deploy Preview for arcus-messaging ready!

Name Link
🔨 Latest commit eb0340a
🔍 Latest deploy log https://app.netlify.com/sites/arcus-messaging/deploys/62c68caeac663400093cb7cc
😎 Deploy Preview https://deploy-preview-312--arcus-messaging.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@stijnmoreels stijnmoreels linked an issue Jul 12, 2022 that may be closed by this pull request
Copy link
Member

@fgheysels fgheysels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we're going to implement this with some kind of factory cfr how we do it in the service-to-service correlation poc ?

@stijnmoreels
Copy link
Member Author

I thought we're going to implement this with some kind of factory cfr how we do it in the service-to-service correlation poc ?

Yes, problem is that the Azure SDK doesn't allow enough 'hooks' for us to create an dedicated ServiceBusSender with all the things required. (mentioned here: #309). So we are left with the same idea that we also support with the HttpClient, and that is extensions.

@stijnmoreels
Copy link
Member Author

stijnmoreels commented Jul 13, 2022

I thought we're going to implement this with some kind of factory cfr how we do it in the service-to-service correlation poc ?

The poc uses the Azure client services to inject an ServiceBusSender, but still does the correlation by itself. Shame that we can't hook enough stuff here to do our correlation tracking.

  • The .AddServiceBusClient doesn't return an extensible type, only a marker interface,
  • The ServiceBusClient.CreateSender can be overriden, but the ServiceBusSender itself is not able to be overriden

@fgheysels
Copy link
Member

I thought we're going to implement this with some kind of factory cfr how we do it in the service-to-service correlation poc ?

The poc uses the Azure client services to inject an ServiceBusSender, but still does the correlation by itself. Shame that we can't hook enough stuff here to do our correlation tracking.

  • The .AddServiceBusClient doesn't return an extensible type, only a marker interface,
  • The ServiceBusClient.CreateSender can be overriden, but the ServiceBusSender itself is not able to be overriden

I was more referring to the ServiceMessageBuilder construct, but as I understand it, we already support this (ServiceMessageBuilder) and this is just an additional way for making sure messages are send with the correct correlation options ?

@stijnmoreels
Copy link
Member Author

I was more referring to the ServiceMessageBuilder construct, but as I understand it, we already support this (ServiceMessageBuilder) and this is just an additional way for making sure messages are send with the correct correlation options ?

Not quite, as these extensions also make sure that the dependency is logged correctly both with the assignment of the dependency ID as well as the duration the dependency call took.
But yes, since we also support the builder, consumers are free to use any one of those.

@fgheysels
Copy link
Member

I was more referring to the ServiceMessageBuilder construct, but as I understand it, we already support this (ServiceMessageBuilder) and this is just an additional way for making sure messages are send with the correct correlation options ?

Not quite, as these extensions also make sure that the dependency is logged correctly both with the assignment of the dependency ID as well as the duration the dependency call took. But yes, since we also support the builder, consumers are free to use any one of those.

I see, with the extension method, the call to the servicebus dependency is logged as well, whereas with the builder, you just create the message with all required properties set. However, you're still responsible for making sure the dependency is logged.

@stijnmoreels
Copy link
Member Author

I was more referring to the ServiceMessageBuilder construct, but as I understand it, we already support this (ServiceMessageBuilder) and this is just an additional way for making sure messages are send with the correct correlation options ?

Not quite, as these extensions also make sure that the dependency is logged correctly both with the assignment of the dependency ID as well as the duration the dependency call took. But yes, since we also support the builder, consumers are free to use any one of those.

I see, with the extension method, the call to the servicebus dependency is logged as well, whereas with the builder, you just create the message with all required properties set. However, you're still responsible for making sure the dependency is logged.

Yes, that's correct! 👍

@stijnmoreels stijnmoreels merged commit a5a656c into arcus-azure:master Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants