Class FailoverTargetSelector

    • Constructor Detail

      • FailoverTargetSelector

        public FailoverTargetSelector()
        Normal constructor.
      • FailoverTargetSelector

        public FailoverTargetSelector​(String clientBootstrapAddress)
      • FailoverTargetSelector

        public FailoverTargetSelector​(Conduit c)
        Constructor, allowing a specific conduit to override normal selection.
        Parameters:
        c - specific conduit
    • Method Detail

      • prepare

        public void prepare​(Message message)
        Called prior to the interceptor chain being traversed.
        Parameters:
        message - the current Message
      • setupExchangeExceptionProperties

        protected void setupExchangeExceptionProperties​(Exchange ex)
      • selectConduit

        public Conduit selectConduit​(Message message)
        Called when a Conduit is actually required.
        Parameters:
        message -
        Returns:
        the Conduit to use for mediation of the message
      • doComplete

        protected void doComplete​(Exchange exchange)
      • setStrategy

        public void setStrategy​(FailoverStrategy strategy)
        Parameters:
        strategy - the FailoverStrategy to use
      • getStrategy

        public FailoverStrategy getStrategy()
        Returns:
        strategy the FailoverStrategy to use
      • getDelayBetweenRetries

        protected long getDelayBetweenRetries()
        Returns delay (in milliseconds) between retries
        Returns:
        delay, 0 means no delay
      • requiresFailover

        protected boolean requiresFailover​(Exchange exchange,
                                           Exception ex)
        Check if the exchange is suitable for a failover.
        Parameters:
        exchange - the current Exchange
        Returns:
        boolean true if a failover should be attempted
      • getFailoverTarget

        protected Endpoint getFailoverTarget​(Exchange exchange,
                                             FailoverTargetSelector.InvocationContext invocation)
        Get the failover target endpoint, if a suitable one is available.
        Parameters:
        exchange - the current Exchange
        invocation - the current InvocationContext
        Returns:
        a failover endpoint if one is available
      • updateContextAlternatives

        protected List<String> updateContextAlternatives​(Exchange exchange,
                                                         FailoverTargetSelector.InvocationContext invocation)
        Fetches and updates the alternative address or/and alternative endpoints (depending on the strategy) for current invocation context.
        Parameters:
        exchange - the current Exchange
        invocation - the current InvocationContext
        Returns:
        alternative addresses
      • overrideAddressProperty

        protected void overrideAddressProperty​(Map<String,​Object> context)
        Override the ENDPOINT_ADDRESS property in the request context
        Parameters:
        context - the request context
      • overrideAddressProperty

        protected void overrideAddressProperty​(Map<String,​Object> context,
                                               String address)
      • isSupportNotAvailableErrorsOnly

        public boolean isSupportNotAvailableErrorsOnly()
      • setSupportNotAvailableErrorsOnly

        public void setSupportNotAvailableErrorsOnly​(boolean support)
      • getClientBootstrapAddress

        public String getClientBootstrapAddress()
      • setClientBootstrapAddress

        public void setClientBootstrapAddress​(String clientBootstrapAddress)
      • getInvocationKey

        protected String getInvocationKey​(Exchange e)