@Override
    public Object handle(CommandMessage<?> command, UnitOfWork unitOfWork, InterceptorChain chain) throws Throwable {
        CommandMessage<?> commandWithKeyAdded = null;
        if (!command.getMetaData().containsKey(CorrelationToken.KEY)) {
            commandWithKeyAdded = command.andMetaData(Collections.singletonMap(CorrelationToken.KEY, new CorrelationToken()));
        }
        UnitOfWorkListener listener = new CorrelationUnitOfWorkListener(commandWithKeyAdded != null ? commandWithKeyAdded : command);
        unitOfWork.registerListener(listener);
        return chain.proceed();
    }
@ Override public Object handle ( CommandMessage < ? > command , UnitOfWork unitOfWork , InterceptorChain chain ) throws Throwable { CommandMessage < ? > commandWithKeyAdded = null ; if ( ! command . getMetaData ( ) . containsKey ( CorrelationToken . KEY ) ) { commandWithKeyAdded = command . andMetaData ( Collections . singletonMap ( CorrelationToken . KEY , new CorrelationToken ( ) ) ) ; } UnitOfWorkListener listener = new CorrelationUnitOfWorkListener ( commandWithKeyAdded != null ? commandWithKeyAdded : command ) ; unitOfWork . registerListener ( listener ) ; return chain . proceed ( ) ; }
Handler method which registers a {@link CorrelationUnitOfWorkListener} if the given command contains the required
meta data to correlate this command to the resulting events.

@throws Throwable no checked exceptions will be thrown. This is required to implement the {@code CommandHandlerInterceptor} interface.