Search code examples
apache-kafkamasstransit

MassTransit Kafka Rider get raw message


I need to get raw message that was sent to kafka for logging. For example, if validation context.Message was failed.

I tried answer from this Is there a way to get raw message from MassTransit?, but it doesn't work and context.TryGetMessage<JToken>() return null all the time.


Solution

  • The Confluent.Kafka client does not expose the raw message data, only the deserialized message type. Therefore, MassTransit does not have a message body accessible.