Class ConnectableService

  • Direct Known Subclasses:
    NettyStreamingService

    public abstract class ConnectableService
    extends Object
    Base class of streaming services, declares connect() method including before connection logic
    • Field Detail

      • BEFORE_CONNECTION_HANDLER

        public static final String BEFORE_CONNECTION_HANDLER
        Exchange specific parameter is used for providing Runnable action which is caused before setup new connection. For example adding throttle control for limiting too often opening connections:
        
         static final TimedSemaphore limiter = new TimedSemaphore(1, MINUTES, 15);
         ExchangeSpecification spec = exchange.getDefaultExchangeSpecification();
         spec.setExchangeSpecificParameters(ImmutableMap.of(
           {@link ConnectableService#BEFORE_CONNECTION_HANDLER}, () -> limiter.acquire()
         ));
         
        See Also:
        Constant Field Values
    • Constructor Detail

      • ConnectableService

        public ConnectableService()
    • Method Detail

      • setBeforeConnectionHandler

        public void setBeforeConnectionHandler​(Runnable beforeConnectionHandler)
      • openConnection

        protected abstract io.reactivex.Completable openConnection()
      • connect

        public io.reactivex.Completable connect()