My flow starts with a polling inbound adapter which hands off the processing to a downstream components on pub/sub channels with async executors and service activator (orchestrator using 2 gateways)
Questions
1. I would like to log a correlation id for every execution of a poll so that I can track the logs for that flow execution independently from another execution of the same flow using this correlationId, something similar to a MDC with UUID. How do I pass this to all the threads involved in the processing and output the correlationId in the log statement?
2. I am also trying to figure out what is the best approach for logging. Currently I have a logging wireTap (consumed by a logging adapter) on all channels. For this one, I want to be able to enable the wireTap interception only when the logging mode is DEBUG For example,
<int:logging-channel-adapter log-full-message="true"
logger-name="tapInbound"
level="DEBUG"
id="loggingChannel"/>
This will only log when application logger is DEBUG, but the wireTap interception will always happen. How to enable the wireTap interception only when log level is DEBUG? Probably by using selector-expression with value of something like isloggingLevelDebug(). How do I do this?