arcus-azure/arcus.messaging

Add Azure Service Bus message generation with dependency ID

stijnmoreels opened this issue · 3 comments

Is your feature request related to a problem? Please describe.
When creating an Azure Service Bus message to be placed on a queue or topic subscription, we need to add an dependency ID to the context properties so that the peaking message pump can track a request in Application Insights.

Describe the solution you'd like
Investigates in how this can be done. Should we extend our extension .AsServiceBusMessage to incorporate this? Should we instead extend the QueueClient and TopicClient to easier access? Keeping in mind that you usually start from a model that needs to be serialized as the message body of the Azure Service Bus message.

Additional context
Relates to https://github.com/arcus-azure/arcus-service-to-service-correlation-poc

The dependencyId should not be part of the actual (business) payload of the message. It should be a meta-property / context property.

The amqp protocol already provides a 'CorrelationId' property, but I feel we should not use this property for our purpose. This is rather a property which is used to correlate between a message and their reply messages.
https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messages-payloads

I think we should add a custom property to the user-defined meta-properties of the message, and let the user specify how that property must be called. (We can also provide a default name).

I am currently wondering if setting the correlation identifier in the message that is posted to servicebus, is the responsability of Arcus.

I'm currently thinking that we should give the developer freedom to decide how / where the correlation identifier must be placed and how that identifier should look like.

For the consumer-side, we should provide some functionality in Arcus to easily retrieve that correlation-id and make sure that it is correctly used when writing the request to the logs (AppInsights). Also, in this case, the developer must be able to specify where the correlation-id can be found.

But, that is just my idea. It would be nice to have some thoughts / ideas / input from other people as well.

Yes, that's a good point. We have already issues created on web API that will help adding this ID when sending out HTTP requests (arcus-azure/arcus.webapi#257 & arcus-azure/arcus.webapi#258). Those ones are of the same 'action' as this one. And so, are also susceptible to this argument?

Without doubt, service-to-service correlation is hard to understand and set up. I'm wondering, if we start documenting this, how we can easily help people if all dependency ID assignment is open and no functionality is available.

There are already lots of topics that could benefit from having input from other people. 😄 But those topics are sometimes on-hold and otherwise done without the feedback. We could definitely have a look how we would do this, ask feedback to the community, but this is maybe something to discuss with everyone involved with Arcus.