Switch branches/tags
Nothing to show
Find file History
Nicky Bass Mølholm Nicky Bass Mølholm
Nicky Bass Mølholm and Nicky Bass Mølholm moved application.yml from test to main
Latest commit eaaf54a Jul 24, 2017
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
gradle/wrapper renamed project Jul 24, 2017
src moved application.yml from test to main Jul 24, 2017
README.adoc moved application.yml from test to main Jul 24, 2017
build.gradle renamed project Jul 24, 2017
gradlew renamed project Jul 24, 2017
gradlew.bat renamed project Jul 24, 2017

README.adoc

Spring 4.3 :: Using a TaskDecorator with @Async functionality

This project demonstrates how you can use a TaskDecorator to transparently copy MDC data from Web threads onto @Async method threads.

Take a look at the integration tests to see what is expected of the code. Notice how we expect MDC data to appear with the Web thread logging and with the @Async thread logging.

Then see com.moelholm.async.demo.MdcFilter: this is where the original MDC data comes from. In src/main/resources/application.yml you find the log configuration that tells Spring Boot to inject an MDC variable next to the logger level.

Next, see com.moelholm.async.demo.Application: notice how we tune the @Async behavior in Spring to use a custom TaskDecorator.

Finally see com.moelholm.async.demo.MdcTaskDecorator: this is where we copy MDC data onto the @Async threads.