@Test public void testFindDestinationReturnsMemberForCommandMessage() { SimpleMember<URI> testMember = new SimpleMember<>( SERVICE_INSTANCE_ID + "[" + SERVICE_INSTANCE_URI + "]", SERVICE_INSTANCE_URI, false, null ); AtomicReference<ConsistentHash> testAtomicConsistentHash = new AtomicReference<>(new ConsistentHash().with(testMember, LOAD_FACTOR, commandMessage -> true)); setFieldValue(atomicConsistentHashField, testSubject, testAtomicConsistentHash); Optional<Member> resultOptional = testSubject.findDestination(TEST_COMMAND); assertTrue(resultOptional.isPresent()); Member resultMember = resultOptional.orElseThrow(IllegalStateException::new); assertMember(REMOTE_MEMBER, resultMember, NOT_REGISTERED); verify(routingStrategy).getRoutingKey(TEST_COMMAND); }
@Override public Optional<Member> findDestination(CommandMessage<?> commandMessage) { return atomicConsistentHash.get().getMember(routingStrategy.getRoutingKey(commandMessage), commandMessage); }
SpringCloudCommandRouter implements CommandRouter { @Override public Optional<Member> findDestination(CommandMessage<?> commandMessage) { return atomicConsistentHash.get().getMember(routingStrategy.getRoutingKey(commandMessage), commandMessage); } }
SpringCloudCommandRouter implements CommandRouter { @Override public Optional<Member> findDestination(CommandMessage<?> commandMessage) { return atomicConsistentHash.get().getMember(routingStrategy.getRoutingKey(commandMessage), commandMessage); } protected  SpringCloudCommandRouter(Builder builder); }
SpringCloudCommandRouter implements CommandRouter { @Override public Optional<Member> findDestination(CommandMessage<?> commandMessage) { return atomicConsistentHash.get().getMember(routingStrategy.getRoutingKey(commandMessage), commandMessage); } protected  SpringCloudCommandRouter(Builder builder); static Builder builder(); static boolean serviceInstanceMetadataContainsMessageRoutingInformation(ServiceInstance serviceInstance); @Override Optional<Member> findDestination(CommandMessage<?> commandMessage); @Override void updateMembership(int loadFactor, CommandMessageFilter commandFilter); @EventListener @SuppressWarnings("UnusedParameters") void resetLocalMembership(InstanceRegisteredEvent event); @EventListener @SuppressWarnings("UnusedParameters") void updateMemberships(HeartbeatEvent event); }
SpringCloudCommandRouter implements CommandRouter { @Override public Optional<Member> findDestination(CommandMessage<?> commandMessage) { return atomicConsistentHash.get().getMember(routingStrategy.getRoutingKey(commandMessage), commandMessage); } protected  SpringCloudCommandRouter(Builder builder); static Builder builder(); static boolean serviceInstanceMetadataContainsMessageRoutingInformation(ServiceInstance serviceInstance); @Override Optional<Member> findDestination(CommandMessage<?> commandMessage); @Override void updateMembership(int loadFactor, CommandMessageFilter commandFilter); @EventListener @SuppressWarnings("UnusedParameters") void resetLocalMembership(InstanceRegisteredEvent event); @EventListener @SuppressWarnings("UnusedParameters") void updateMemberships(HeartbeatEvent event);  }