arcus-azure/arcus.messaging

CorrelationId and other properties are not available via the AzureServiceBusMessageContext

Opened this issue · 5 comments

Is your feature request related to a problem? Please describe.
We have a system that posts messages to Azure ServiceBus, and that system uses the CorrelationId property of the ServiceBusMessage to add a correlation-id to the message.

We have another process that consumes ServiceBus via Arcus.Messaging, but there seems to be no way to retrieve the CorrelationId property from the message.
I believe this property should be available through the AzureServiceBusMessageContext class ?

Note that there also other properties available on ServiceBusMessage that might be of interest:

  • ContentType
  • MessageId
  • ReplyTo
  • SessionId
  • ...

I believe that the message's correlation ID will correspond with the operation ID that is available in the MessageCorrelationInfo. It would be breaking of abstraction if it would be available in the message context.

For the other properties, you can use the system properties within the message context to get the available ones: https://github.com/arcus-azure/arcus.messaging/blob/main/src/Arcus.Messaging.Abstractions.ServiceBus/AzureServiceBusSystemProperties.cs

Note that the Arcus ServiceBusMessage builders are not used. The CorrelationId that has been set is not available in the MessageCorrelationInfo information of the context. The MessageCorrelationInfo structure contains some other (generated) information though. Might be an idea to first look at the CorrelationId property of the message before generating a new value of the operationId ?

I understand that we should not break abstraction, but on the other hand, the class is called AzureServiceBusContext , but I understand that we should have this available through the base class as well.

The correlation information in a W3C context is not generated, but retrieved from the current activity and (I thought) the correlation ID of the message?

Hi Stijn!
Chiming in here with some screenshots of the specific case in which we are encountering this issue. First one shows the correlation id I set in the Broker Properties of the message I post on service bus and the second one shows the operation id I see in the MessageCorrelationInfo object I subsequently receive in my code. As you can see these do not seem to match.
Schermafbeelding 2023-11-08 131938
Schermafbeelding 2023-11-08 132423

I'm just thinking that the CorrelationId might be something that was used for Hierarchical tracking, but not for W3C correlation 🤔 It might be something 'extra' for service bus, but not required for W3C service-to-service correlation.