// we wait (at most 10 seconds) for the replay to complete.
future.get(10, TimeUnit.SECONDS);
// and we publish another event to show that it's handled in the calling thread
eventBus.publish(asEventMessage(new ToDoItemDeadlineExpiredEvent("todo1")));
// we want to shutdown the application context to get a clean JVM shutdown
applicationContext.close();
}