/** * {@inheritDoc} * <p/> * In the DistributedCommandBus, the handler is subscribed to the local segment only. */ @Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> handler) { Registration reg = connector.subscribe(commandName, handler); updateFilter(commandFilter.get().or(new CommandNameFilter(commandName))); return () -> { updateFilter(commandFilter.get().and(new DenyCommandNameFilter(commandName))); return reg.cancel(); }; }
/** * {@inheritDoc} * <p/> * In the DistributedCommandBus, the handler is subscribed to the local segment only. */ @Override public Registration subscribe(String commandName, MessageHandler<? super CommandMessage<?>> handler) { Registration reg = connector.subscribe(commandName, handler); updateFilter(commandFilter.get().or(new CommandNameFilter(commandName))); return () -> { updateFilter(commandFilter.get().and(new DenyCommandNameFilter(commandName))); return reg.cancel(); }; }