Hey Everyone,
We currently have a Saga that sends 2 request/response (full-duplex) messages, that are of the same message type ( AddNoteToOrder ), throughout it’s execution for a SINGLE order.
AddNoteToOrder
- OrderId
- Subject
- Note
Our Saga needs to perform different logic for each response. Therefore, we need to distinguish between which response came from what request.
Is there any advice on how we should approach this? I see the below options:
-
Generate a Guid and use this as the messageId of the request. This will be set by the nservicebus framework as the correlationid “automatically” on the response message. I can then use this to understand what request this response is associated with.
-
Add a property of type GUID to the message called CorrelationId to the request and response message. Assign the value to the CorrelationId on the response message.
-
Use some existing property of combination of properties on the existing message. This seems like a bad idea depending on which and what properties are used because this would be unclear to the consumer which one can be used as a correlation id and is expected to be “unique” between messages.
For Option 1, i couldn’t find any information in the nservicebus documentation referring to this. i was not sure if this is considered bad practice. For Example, is the NServiceBus CorrelationId header only meant to be used internally by nservicebus for request/response correlation OR can this be used for applications to take advantage of?
Any advice and feedback would be great on this!