If you have a CorrelationDataProvider registered, Axon automatically propagates metadata from one message to the next as the application publishes them.
But it seems like the chain is broken when the workflow involves a scheduled event. Nothing in the event scheduler knows how to pull correlation data out of the message that's currently being processed, so you lose out on the convenient automatic propagation.
How are other people dealing with this, if at all?
One option is to have the application code explicitly populate the metadata when it schedules the event, but that seems like it could get unwieldy fast.
Another idea is to do it with message interceptors and thread-local variables: something that pulls out the correlation data before the event/command handler is called and stashes it into a ThreadLocal, and then a wrapper around the event scheduler that looks at the ThreadLocal and adds to the scheduled event's metadata. If the application starts a new UnitOfWork, it'll have to clear the correlation data if needed.
Any other approaches I should consider?