@Override public String getRoutingKey(CommandMessage<?> command) { String routingKey = doResolveRoutingKey(command); if (routingKey == null) { switch (unresolvedRoutingKeyPolicy) { case ERROR: throw new CommandDispatchException(format("The command [%s] does not contain a routing key.", command.getCommandName())); case RANDOM_KEY: return Long.toHexString(counter.getAndIncrement()); case STATIC_KEY: return STATIC_ROUTING_KEY; default: throw new IllegalStateException("The configured UnresolvedRoutingPolicy of " + unresolvedRoutingKeyPolicy.name() + " is not supported."); } } return routingKey; }
@Override public String getRoutingKey(CommandMessage<?> command) { String routingKey = doResolveRoutingKey(command); if (routingKey == null) { switch (unresolvedRoutingKeyPolicy) { case ERROR: throw new CommandDispatchException(format("The command [%s] does not contain a routing key.", command.getCommandName())); case RANDOM_KEY: return Long.toHexString(counter.getAndIncrement()); case STATIC_KEY: return STATIC_ROUTING_KEY; } } return routingKey; }
@Override public String getRoutingKey(CommandMessage<?> command) { String routingKey = doResolveRoutingKey(command); if (routingKey == null) { switch (unresolvedRoutingKeyPolicy) { case ERROR: throw new CommandDispatchException(format("The command [%s] does not contain a routing key.", command.getCommandName())); case RANDOM_KEY: return Long.toHexString(counter.getAndIncrement()); case STATIC_KEY: return STATIC_ROUTING_KEY; default: throw new IllegalStateException("The configured UnresolvedRoutingPolicy of " + unresolvedRoutingKeyPolicy.name() + " is not supported."); } } return routingKey; }
@Override public String getRoutingKey(CommandMessage<?> command) { String routingKey = doResolveRoutingKey(command); if (routingKey == null) { switch (unresolvedRoutingKeyPolicy) { case ERROR: throw new CommandDispatchException(format("The command [%s] does not contain a routing key.", command.getCommandName())); case RANDOM_KEY: return Long.toHexString(counter.getAndIncrement()); case STATIC_KEY: return STATIC_ROUTING_KEY; default: throw new IllegalStateException("The configured UnresolvedRoutingPolicy of " + unresolvedRoutingKeyPolicy.name() + " is not supported."); } } return routingKey; }