Interface ProcessorExchangeFactory

All Superinterfaces:
AutoCloseable, CamelContextAware, HasCamelContext, HasId, IdAware, NonManagedService, PooledObjectFactory<Exchange>, RouteIdAware, Service

public interface ProcessorExchangeFactory extends PooledObjectFactory<Exchange>, NonManagedService, RouteIdAware, IdAware
Factory used by Processor implementations (EIPs) when they create copies of the current Exchange for sub-routing.

EIPs such as WireTap, Multicast, and Splitter each create one or more derived exchanges (copies or correlated copies) to fan out processing. This factory gives those EIPs the same exchange-pooling benefit as ExchangeFactory gives to consumers, without conflating the two lifecycle boundaries.

Like ExchangeFactory, this factory is pluggable:

  • default — creates a new Exchange copy per sub-routing invocation.
  • pooled — reuses PooledExchange instances, recycling them after the sub-exchange completes its portion of the route.
Each stateful EIP receives its own private ProcessorExchangeFactory instance via newProcessorExchangeFactory(org.apache.camel.Processor).
Since:
3.10
See Also:
  • Field Details

  • Method Details

    • getProcessor

      Processor getProcessor()
      The processor using this factory.
    • newProcessorExchangeFactory

      ProcessorExchangeFactory newProcessorExchangeFactory(Processor processor)
      Creates a new ProcessorExchangeFactory that is private for the given consumer.
      Parameters:
      processor - the processor that will use the created ProcessorExchangeFactory
      Returns:
      the created factory.
    • createCopy

      Exchange createCopy(Exchange exchange)
      Gets a copy of the given Exchange
      Parameters:
      exchange - original exchange
    • createCorrelatedCopy

      Exchange createCorrelatedCopy(Exchange exchange, boolean handover)
      Gets a copy of the given Exchange and the copy is correlated to the source
      Parameters:
      exchange - original exchange
      handover - whether the on completion callbacks should be handed over to the new copy.
    • create

      Exchange create(Endpoint fromEndpoint, ExchangePattern exchangePattern)
      Gets a new Exchange
    • release

      boolean release(Exchange exchange)
      Releases the exchange back into the pool
      Specified by:
      release in interface PooledObjectFactory<Exchange>
      Parameters:
      exchange - the exchange
      Returns:
      true if released into the pool, or false if something went wrong and the exchange was discarded