Package org.apache.camel.spi
Interface ProcessorExchangeFactory
-
- All Superinterfaces:
AutoCloseable,CamelContextAware,HasId,IdAware,NonManagedService,PooledObjectFactory<Exchange>,RouteIdAware,Service
public interface ProcessorExchangeFactory extends PooledObjectFactory<Exchange>, NonManagedService, RouteIdAware, IdAware
Factory used byProcessor(EIPs) when they create copies of the processedExchange. Some EIPs like WireTap, Multicast, Split etc creates copies of the processed exchange which they use as sub exchanges. This factory allows to use exchange pooling. The factory is pluggable which allows to use different strategies. The default factory will create a newExchangeinstance, and the pooled factory will pool and reuse exchanges.- See Also:
ExchangeFactory,PooledExchange
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.camel.spi.PooledObjectFactory
PooledObjectFactory.Statistics
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Exchangecreate(Endpoint fromEndpoint, ExchangePattern exchangePattern)Gets a newExchangeExchangecreateCopy(Exchange exchange)Gets a copy of the givenExchangeExchangecreateCorrelatedCopy(Exchange exchange, boolean handover)Gets a copy of the givenExchangethe the copy is correlated to the sourceProcessorgetProcessor()The processor using this factory.ProcessorExchangeFactorynewProcessorExchangeFactory(Processor processor)Creates a newProcessorExchangeFactorythat is private for the given consumer.booleanrelease(Exchange exchange)Releases the exchange back into the pool-
Methods inherited from interface org.apache.camel.CamelContextAware
getCamelContext, setCamelContext
-
Methods inherited from interface org.apache.camel.spi.IdAware
setGeneratedId, setId
-
Methods inherited from interface org.apache.camel.spi.PooledObjectFactory
acquire, getCapacity, getSize, getStatistics, isPooled, isStatisticsEnabled, purge, resetStatistics, setCapacity, setStatisticsEnabled
-
Methods inherited from interface org.apache.camel.spi.RouteIdAware
getRouteId, setRouteId
-
-
-
-
Field Detail
-
FACTORY
static final String FACTORY
Service factory key.- See Also:
- Constant Field Values
-
-
Method Detail
-
getProcessor
Processor getProcessor()
The processor using this factory.
-
newProcessorExchangeFactory
ProcessorExchangeFactory newProcessorExchangeFactory(Processor processor)
Creates a newProcessorExchangeFactorythat is private for the given consumer.- Parameters:
processor- the processor that will use the createdProcessorExchangeFactory- Returns:
- the created factory.
-
createCopy
Exchange createCopy(Exchange exchange)
Gets a copy of the givenExchange- Parameters:
exchange- original exchange
-
createCorrelatedCopy
Exchange createCorrelatedCopy(Exchange exchange, boolean handover)
Gets a copy of the givenExchangethe the copy is correlated to the source- Parameters:
exchange- original exchangehandover- whether the on completion callbacks should be handed over to the new copy.
-
create
Exchange create(Endpoint fromEndpoint, ExchangePattern exchangePattern)
Gets a newExchange
-
release
boolean release(Exchange exchange)
Releases the exchange back into the pool- Specified by:
releasein interfacePooledObjectFactory<Exchange>- Parameters:
exchange- the exchange- Returns:
- true if released into the pool, or false if something went wrong and the exchange was discarded
-
-