@Test void subscribe() { Registration registration = testSubject.subscribe(String.class.getName(), c -> "Done"); assertWithin(500, TimeUnit.MILLISECONDS, () -> assertNotNull(dummyMessagePlatformServer.subscriptions(String.class.getName()))); registration.cancel(); assertWithin(500, TimeUnit.MILLISECONDS, () -> assertNull(dummyMessagePlatformServer.subscriptions(String.class.getName()))); }
@Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler) { logger.debug("Subscribing command with name [{}]", commandName); Registration localRegistration = localSegment.subscribe(commandName, messageHandler); io.axoniq.axonserver.connector.Registration serverRegistration = axonServerConnectionManager.getConnection() .commandChannel() .registerCommandHandler( c -> { CompletableFuture<CommandResponse> result = new CompletableFuture<>(); executorService.submit(new CommandProcessingTask( c, serializer, result, localSegment )); return result; }, loadFactorProvider.getFor(commandName), commandName ); return new AxonServerRegistration(localRegistration, serverRegistration::cancel); }
AxonServerCommandBus implements CommandBus, Distributed<CommandBus> { @Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler) { logger.debug("Subscribing command with name [{}]", commandName); Registration localRegistration = localSegment.subscribe(commandName, messageHandler); io.axoniq.axonserver.connector.Registration serverRegistration = axonServerConnectionManager.getConnection() .commandChannel() .registerCommandHandler( c -> { CompletableFuture<CommandResponse> result = new CompletableFuture<>(); executorService.submit(new CommandProcessingTask( c, serializer, result, localSegment )); return result; }, loadFactorProvider.getFor(commandName), commandName ); return new AxonServerRegistration(localRegistration, serverRegistration::cancel); } }
AxonServerCommandBus implements CommandBus, Distributed<CommandBus> { @Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler) { logger.debug("Subscribing command with name [{}]", commandName); Registration localRegistration = localSegment.subscribe(commandName, messageHandler); io.axoniq.axonserver.connector.Registration serverRegistration = axonServerConnectionManager.getConnection() .commandChannel() .registerCommandHandler( c -> { CompletableFuture<CommandResponse> result = new CompletableFuture<>(); executorService.submit(new CommandProcessingTask( c, serializer, result, localSegment )); return result; }, loadFactorProvider.getFor(commandName), commandName ); return new AxonServerRegistration(localRegistration, serverRegistration::cancel); } AxonServerCommandBus(Builder builder); }
AxonServerCommandBus implements CommandBus, Distributed<CommandBus> { @Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler) { logger.debug("Subscribing command with name [{}]", commandName); Registration localRegistration = localSegment.subscribe(commandName, messageHandler); io.axoniq.axonserver.connector.Registration serverRegistration = axonServerConnectionManager.getConnection() .commandChannel() .registerCommandHandler( c -> { CompletableFuture<CommandResponse> result = new CompletableFuture<>(); executorService.submit(new CommandProcessingTask( c, serializer, result, localSegment )); return result; }, loadFactorProvider.getFor(commandName), commandName ); return new AxonServerRegistration(localRegistration, serverRegistration::cancel); } AxonServerCommandBus(Builder builder); static Builder builder(); @StartHandler(phase = Phase.INBOUND_COMMAND_CONNECTOR) void start(); @Override void dispatch(CommandMessage<C> command); @Override void dispatch(CommandMessage<C> commandMessage,
                                CommandCallback<? super C, ? super R> commandCallback); @Override Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler); @Override CommandBus localSegment(); @Override Registration registerHandlerInterceptor(
            MessageHandlerInterceptor<? super CommandMessage<?>> handlerInterceptor); @Override Registration registerDispatchInterceptor(
            MessageDispatchInterceptor<? super CommandMessage<?>> dispatchInterceptor); @ShutdownHandler(phase = Phase.INBOUND_COMMAND_CONNECTOR) CompletableFuture<Void> disconnect(); @ShutdownHandler(phase = Phase.OUTBOUND_COMMAND_CONNECTORS) CompletableFuture<Void> shutdownDispatching(); }
AxonServerCommandBus implements CommandBus, Distributed<CommandBus> { @Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler) { logger.debug("Subscribing command with name [{}]", commandName); Registration localRegistration = localSegment.subscribe(commandName, messageHandler); io.axoniq.axonserver.connector.Registration serverRegistration = axonServerConnectionManager.getConnection() .commandChannel() .registerCommandHandler( c -> { CompletableFuture<CommandResponse> result = new CompletableFuture<>(); executorService.submit(new CommandProcessingTask( c, serializer, result, localSegment )); return result; }, loadFactorProvider.getFor(commandName), commandName ); return new AxonServerRegistration(localRegistration, serverRegistration::cancel); } AxonServerCommandBus(Builder builder); static Builder builder(); @StartHandler(phase = Phase.INBOUND_COMMAND_CONNECTOR) void start(); @Override void dispatch(CommandMessage<C> command); @Override void dispatch(CommandMessage<C> commandMessage,
                                CommandCallback<? super C, ? super R> commandCallback); @Override Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> messageHandler); @Override CommandBus localSegment(); @Override Registration registerHandlerInterceptor(
            MessageHandlerInterceptor<? super CommandMessage<?>> handlerInterceptor); @Override Registration registerDispatchInterceptor(
            MessageDispatchInterceptor<? super CommandMessage<?>> dispatchInterceptor); @ShutdownHandler(phase = Phase.INBOUND_COMMAND_CONNECTOR) CompletableFuture<Void> disconnect(); @ShutdownHandler(phase = Phase.OUTBOUND_COMMAND_CONNECTORS) CompletableFuture<Void> shutdownDispatching();  }