Package org.apache.camel.spi
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
(EIPs) when they create copies of the processed Exchange
.
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 new
Exchange
instance, and the pooled factory will pool and reuse exchanges.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.spi.PooledObjectFactory
PooledObjectFactory.Statistics
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(Endpoint fromEndpoint, ExchangePattern exchangePattern) Gets a newExchange
createCopy
(Exchange exchange) Gets a copy of the givenExchange
createCorrelatedCopy
(Exchange exchange, boolean handover) Gets a copy of the givenExchange
and the copy is correlated to the sourceThe processor using this factory.newProcessorExchangeFactory
(Processor processor) Creates a newProcessorExchangeFactory
that is private for the given consumer.boolean
Releases the exchange back into the poolMethods inherited from interface org.apache.camel.CamelContextAware
setCamelContext
Methods inherited from interface org.apache.camel.spi.HasCamelContext
getCamelContext
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 Details
-
FACTORY
Service factory key.- See Also:
-
-
Method Details
-
getProcessor
Processor getProcessor()The processor using this factory. -
newProcessorExchangeFactory
Creates a newProcessorExchangeFactory
that is private for the given consumer.- Parameters:
processor
- the processor that will use the createdProcessorExchangeFactory
- Returns:
- the created factory.
-
createCopy
Gets a copy of the givenExchange
- Parameters:
exchange
- original exchange
-
create
Gets a newExchange
-
release
Releases the exchange back into the pool- Specified by:
release
in interfacePooledObjectFactory<Exchange>
- Parameters:
exchange
- the exchange- Returns:
- true if released into the pool, or false if something went wrong and the exchange was discarded
-