Class RecipientListProcessor

  • All Implemented Interfaces:
    AutoCloseable, org.apache.camel.AsyncProcessor, org.apache.camel.Navigate<org.apache.camel.Processor>, org.apache.camel.Processor, org.apache.camel.Service, org.apache.camel.ShutdownableService, org.apache.camel.spi.ErrorHandlerAware, org.apache.camel.spi.HasId, org.apache.camel.spi.IdAware, org.apache.camel.spi.RouteIdAware, org.apache.camel.StatefulService, org.apache.camel.SuspendableService, org.apache.camel.Traceable

    public class RecipientListProcessor
    extends MulticastProcessor
    Implements a dynamic Recipient List pattern where the list of actual endpoints to send a message exchange to are dependent on some dynamic expression.

    This implementation is a specialized MulticastProcessor which is based on recipient lists. This implementation have to handle the fact the processors is not known at design time but evaluated at runtime from the dynamic recipient list. Therefore this implementation have to at runtime lookup endpoints and create producers which should act as the processors for the multicast processors which runs under the hood. Also this implementation supports the asynchronous routing engine which makes the code more trickier.

    • Constructor Detail

      • RecipientListProcessor

        public RecipientListProcessor​(org.apache.camel.CamelContext camelContext,
                                      org.apache.camel.Route route,
                                      org.apache.camel.Expression expression,
                                      String delimiter,
                                      org.apache.camel.spi.ProducerCache producerCache,
                                      org.apache.camel.AggregationStrategy aggregationStrategy,
                                      boolean parallelProcessing,
                                      ExecutorService executorService,
                                      boolean shutdownExecutorService,
                                      boolean streaming,
                                      boolean stopOnException,
                                      long timeout,
                                      org.apache.camel.Processor onPrepare,
                                      boolean shareUnitOfWork,
                                      boolean parallelAggregate)
    • Method Detail

      • getCacheSize

        public int getCacheSize()
      • setCacheSize

        public void setCacheSize​(int cacheSize)
      • isIgnoreInvalidEndpoints

        public boolean isIgnoreInvalidEndpoints()
      • setIgnoreInvalidEndpoints

        public void setIgnoreInvalidEndpoints​(boolean ignoreInvalidEndpoints)
      • createProcessorExchangePair

        protected ProcessorExchangePair createProcessorExchangePair​(int index,
                                                                    org.apache.camel.Endpoint endpoint,
                                                                    org.apache.camel.Producer producer,
                                                                    org.apache.camel.Exchange exchange,
                                                                    org.apache.camel.ExchangePattern pattern,
                                                                    boolean prototypeEndpoint)
        This logic is similar to MulticastProcessor but we have to return a RecipientProcessorExchangePair instead
      • prepareRecipient

        protected static Object prepareRecipient​(org.apache.camel.Exchange exchange,
                                                 Object recipient)
                                          throws org.apache.camel.NoTypeConversionAvailableException
        Throws:
        org.apache.camel.NoTypeConversionAvailableException
      • getExistingEndpoint

        protected static org.apache.camel.Endpoint getExistingEndpoint​(org.apache.camel.Exchange exchange,
                                                                       Object recipient)
      • resolveEndpoint

        protected static org.apache.camel.Endpoint resolveEndpoint​(org.apache.camel.Exchange exchange,
                                                                   Object recipient,
                                                                   boolean prototype)
      • resolveExchangePattern

        protected org.apache.camel.ExchangePattern resolveExchangePattern​(Object recipient)
      • setToEndpoint

        protected static void setToEndpoint​(org.apache.camel.Exchange exchange,
                                            org.apache.camel.Endpoint endpoint)