Set conversation identifier

Scenario:
we want to correlate all our logging statements so that we can programmatically verify that all the expected flows are executed.

based on the documentation we are thinking of logging the conversation identifier along with the log statements for correlation.

Questions

  1. Can we programmatically set the conversation Id in the header before the first message is sent and will it be propagated to all the following events/commands/messages ?
  2. We understand that we can setup our own custom header, but will this be propagated to all the events/commands/messages in the flow OOB or should we write an extension for this ? any example on how to do this ?

Thanks -Nen.

Hi -Nen,

You can set the ConversationId when you send the first message or you can define a custom strategy which allows you to control the generation of all Conversation Ids. You could use this to log the conversation id as soon as it is generated. See here in the documentation for details on how.

If you do want to go with a custom header then you’d need to write your own behavior to propagate it. We have a sample showing how to do that here.

Regards,
Mike