I have two services, A and B, communicating via Spring Remoting with AMQP. A exposes a REST API and populates the MDC (Mapped Diagnostic Context) with a UUID.randomUUID() (from within a Filter) on every request (and clears it when processing is finished). Now I'd like to pass this UUID to B in the request/reply cycle so that...
- ... when a consumer in B starts processing the request, its MDC is populated with the UUID.
- ... when the consumer in B finishes processing the request, its MDC is cleared.
I've extended SimpleMessageConverter so as to set an AMQP header containing the UUID, but I don't really seem to figure out how/where to populate and how/where to clear the MDC in B. Can anyone please shed some light?
Inject another custom message converter into the
AmqpInvokerServiceExporter.Set the MDC (from the header) in
fromMessage(), clear it when the reply is mapped (intoMessage).