@Test public void testSendWithoutCallbackSucceeds() { testSubject.send(DESTINATION, COMMAND_MESSAGE); verify(executor).execute(any()); verify(serializer).serialize(COMMAND_MESSAGE.getMetaData(), byte[].class); verify(serializer).serialize(COMMAND_MESSAGE.getPayload(), byte[].class); HttpEntity<SpringHttpDispatchMessage<String>> expectedHttpEntity = new HttpEntity<>(buildDispatchMessage(false)); verify(restTemplate).exchange(eq(expectedUri), eq(HttpMethod.POST), eq(expectedHttpEntity), argThat(new ParameterizedTypeReferenceMatcher<>())); }
@Override public <C> void send(Member destination, CommandMessage<? extends C> commandMessage) { shutdownLatch.ifShuttingDown("JGroupsConnector is shutting down, no new commands will be sent."); if (destination.local()) { localCommandBus.dispatch(commandMessage); } else { executor.execute(() -> sendRemotely(destination, commandMessage, DO_NOT_EXPECT_REPLY)); } }
SpringHttpCommandBusConnector implements CommandBusConnector { @Override public <C> void send(Member destination, CommandMessage<? extends C> commandMessage) { shutdownLatch.ifShuttingDown("JGroupsConnector is shutting down, no new commands will be sent."); if (destination.local()) { localCommandBus.dispatch(commandMessage); } else { executor.execute(() -> sendRemotely(destination, commandMessage, DO_NOT_EXPECT_REPLY)); } } }
SpringHttpCommandBusConnector implements CommandBusConnector { @Override public <C> void send(Member destination, CommandMessage<? extends C> commandMessage) { shutdownLatch.ifShuttingDown("JGroupsConnector is shutting down, no new commands will be sent."); if (destination.local()) { localCommandBus.dispatch(commandMessage); } else { executor.execute(() -> sendRemotely(destination, commandMessage, DO_NOT_EXPECT_REPLY)); } } protected  SpringHttpCommandBusConnector(Builder builder); }
SpringHttpCommandBusConnector implements CommandBusConnector { @Override public <C> void send(Member destination, CommandMessage<? extends C> commandMessage) { shutdownLatch.ifShuttingDown("JGroupsConnector is shutting down, no new commands will be sent."); if (destination.local()) { localCommandBus.dispatch(commandMessage); } else { executor.execute(() -> sendRemotely(destination, commandMessage, DO_NOT_EXPECT_REPLY)); } } protected  SpringHttpCommandBusConnector(Builder builder); @StartHandler(phase = Phase.EXTERNAL_CONNECTIONS) void start(); static Builder builder(); @Override void send(Member destination, CommandMessage<? extends C> commandMessage); @Override void send(Member destination,
                            CommandMessage<C> commandMessage,
                            CommandCallback<? super C, R> callback); @Override CompletableFuture<Void> initiateShutdown(); @Override Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> handler); @Override Optional<CommandBus> localSegment(); @PostMapping("/command") CompletableFuture<?> receiveCommand(@RequestBody SpringHttpDispatchMessage<C> dispatchMessage); @Override Registration registerHandlerInterceptor(
            MessageHandlerInterceptor<? super CommandMessage<?>> handlerInterceptor); }
SpringHttpCommandBusConnector implements CommandBusConnector { @Override public <C> void send(Member destination, CommandMessage<? extends C> commandMessage) { shutdownLatch.ifShuttingDown("JGroupsConnector is shutting down, no new commands will be sent."); if (destination.local()) { localCommandBus.dispatch(commandMessage); } else { executor.execute(() -> sendRemotely(destination, commandMessage, DO_NOT_EXPECT_REPLY)); } } protected  SpringHttpCommandBusConnector(Builder builder); @StartHandler(phase = Phase.EXTERNAL_CONNECTIONS) void start(); static Builder builder(); @Override void send(Member destination, CommandMessage<? extends C> commandMessage); @Override void send(Member destination,
                            CommandMessage<C> commandMessage,
                            CommandCallback<? super C, R> callback); @Override CompletableFuture<Void> initiateShutdown(); @Override Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> handler); @Override Optional<CommandBus> localSegment(); @PostMapping("/command") CompletableFuture<?> receiveCommand(@RequestBody SpringHttpDispatchMessage<C> dispatchMessage); @Override Registration registerHandlerInterceptor(
            MessageHandlerInterceptor<? super CommandMessage<?>> handlerInterceptor);  }