0

I am using SpringIntegration's IntegrationFlows to define the message flow, and used Jms.messageDrivenChannelAdapter to get the message from the MQ, now I need to parse it, send it to KAFKA and update couchbase.

IntegrationFlows
                .from(Jms.messageDrivenChannelAdapter(this.acarsMqListener))  //MQ Listener with session transacted=true
                .wireTap(ACARS_WIRE_TAP_CHNL)                                 // Logging the message
                .transform(agmTransformer, "parseXMLMessage")                                 .filter(acarsFilter,"filterMessageOnSmiImi")                  // Filter the message based on condition
                .handle(acarsProcessor, "processEvent")                       // Create the message
                .handle(Kafka.outboundChannelAdapter(kafkaTemplate).messageKey(MESSAGE_KEY).topic(acarsKafkaTopic))  //send it to kafka
                .handle(updateCouchbase, "saveToDB")                          // Update couchbase
                .get();

For each message received we want to log it using MDC to help us to collect/aggregate it based on UUID. Please suggest how to put the UUID in MDC and then clear out the MDC for each message in the above flow

Developer
  • 239
  • 1
  • 3
  • 17

1 Answers1

0

You just can configure a global WireTap and do an appropriate transformation over there in that wire-tapped flow before logging the message.

On the other hand there might be just need to play with MDC since you can inject something like For header into the message and log() them as usual, so you will see messages in logs and would be able to correlate using that header.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118