No CorrelationId in Azure

65 views
Skip to first unread message

Robert Witt

unread,
Oct 29, 2017, 1:26:53 PM10/29/17
to masstransit-discuss
Hi, sorry for so many questions in rapid succession. I appreciate all the help.

My latest question: Even when my messages implement CorrelatedBy<Guid>, no Guid is being automatically generated. There is a MessageId and a ConversationId, but there is no CorrelationId unless I specify it. Is that expected? Is it specific to Azure? Is there maybe a setting I'm missing? The page below made me think it would be automagic:

If it's not automagic, that's fine; I just want to make sure I'm doing it right.
Thanks again!

Chris Patterson

unread,
Oct 29, 2017, 11:06:42 PM10/29/17
to masstrans...@googlegroups.com
You need to set it yourself (CorrelationId) if you put it on the message. I suggest.NewId.NextGuid().


--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/masstransit-discuss/0cbc8011-37ed-411b-ba85-ddbf33520921%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Witt

unread,
Oct 30, 2017, 3:31:50 AM10/30/17
to masstransit-discuss
Super, thanks again.
 

Alexey Zimarev

unread,
Oct 30, 2017, 3:10:21 PM10/30/17
to masstransit-discuss
The idea of correlation id is that it is known to you. So you can correlate different messages to each other, creating a meaningful thread of communication. If correlation id would be automatically generated for each message, what is the point to have it? How would you correlate these messages if they all have different correlation id?

Robert Witt

unread,
Oct 30, 2017, 3:35:20 PM10/30/17
to masstransit-discuss
I agree that it's perfectly reasonable to set the correlation id myself. However, one could imagine that messages sent from the "bus" level are automatically assigned a new correlation id, and ones sent from a consumer context automatically copy the correlation id that invoked the consumer. Automagic correlation. I'm sure it's more complicated than it sounds, but MassTransit already does so many awesome things, I thought I'd ask. :)

Alexey Zimarev

unread,
Oct 30, 2017, 3:37:17 PM10/30/17
to masstransit-discuss
Well, it is not really helpful to generate the correlation id. For example, I can have a natural id and generate a deterministic guid based on it, throughout the whole system, so I can correlate on something I know even not having the initial message. Saga id, for example, is a very good example.

Chris Patterson

unread,
Oct 31, 2017, 12:52:01 PM10/31/17
to masstrans...@googlegroups.com
MT does move the CorrelationId to the InitiatorId for messages sent/published from a consumer, if the message had a CorrelationId. So it does that for you. It also copies the unique ConversationId across all messages, and generates a new one if one doesn't exists, so that messages within the same chain are correlated as well.

ConversationId = owned by MT, copied to all messages in a chain
CorrelationId = assigned by you initially, copied by MT to message chain to track causation



On Mon, Oct 30, 2017 at 12:37 PM, Alexey Zimarev <azim...@gmail.com> wrote:
Well, it is not really helpful to generate the correlation id. For example, I can have a natural id and generate a deterministic guid based on it, throughout the whole system, so I can correlate on something I know even not having the initial message. Saga id, for example, is a very good example.

--
You received this message because you are subscribed to the Google Groups "masstransit-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to masstransit-discuss+unsub...@googlegroups.com.
To post to this group, send email to masstransit-discuss@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages