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 newExchange
instance, 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 Exchange
create(Endpoint fromEndpoint, ExchangePattern exchangePattern)
Gets a newExchange
Exchange
createCopy(Exchange exchange)
Gets a copy of the givenExchange
Exchange
createCorrelatedCopy(Exchange exchange, boolean handover)
Gets a copy of the givenExchange
the the copy is correlated to the sourceProcessor
getProcessor()
The processor using this factory.ProcessorExchangeFactory
newProcessorExchangeFactory(Processor processor)
Creates a newProcessorExchangeFactory
that is private for the given consumer.boolean
release(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 newProcessorExchangeFactory
that 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 givenExchange
the 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:
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
-
-