@Override protected String doResolveRoutingKey(CommandMessage<?> command) { Object value = command.getMetaData().get(metaDataKey); return value == null ? null : value.toString(); } }
/** * Creates a {@code CorrelationUnitOfWorkListener} which adds correlation meta data to registered events. * * @param command the command for which * @throws NullPointerException if {@code command} is {@code null}. * @throws IllegalArgumentException if {@code command} does not contain the {@code correlationToken} or if the * {@code correlationToken} is not a {@code CorrelationToken}. */ public CorrelationUnitOfWorkListener(CommandMessage<?> command) { checkNotNull(command); checkArgument(command.getMetaData().containsKey(CorrelationToken.KEY)); checkArgument(command.getMetaData().get(CorrelationToken.KEY) instanceof CorrelationToken); correlationToken = (CorrelationToken) command.getMetaData().get(CorrelationToken.KEY); }