public class HazelcastAggregationRepository
extends org.apache.camel.support.service.ServiceSupport
implements org.apache.camel.spi.RecoverableAggregationRepository, org.apache.camel.spi.OptimisticLockingAggregationRepository
RecoverableAggregationRepository and
OptimisticLockingAggregationRepository. Defaults to thread-safe (non-optimistic) locking and recoverable
strategy. Hazelcast settings are given to an end-user and can be controlled with repositoryName and
persistentRespositoryName, both are IMap <String, Exchange>. However
HazelcastAggregationRepository can run it's own Hazelcast instance, but obviously no benefits of Hazelcast clustering
are gained this way. If the HazelcastAggregationRepository uses it's own local HazelcastInstance it
will DESTROY this instance on doStop(). You should control HazelcastInstance lifecycle yourself
whenever you instantiate HazelcastAggregationRepository passing a reference to the instance.| Modifier and Type | Field and Description |
|---|---|
protected boolean |
allowSerializedHeaders |
protected com.hazelcast.map.IMap<String,org.apache.camel.support.DefaultExchangeHolder> |
cache |
protected static String |
COMPLETED_SUFFIX |
protected String |
deadLetterChannel |
protected com.hazelcast.core.HazelcastInstance |
hzInstance |
protected String |
mapName |
protected int |
maximumRedeliveries |
protected boolean |
optimistic |
protected com.hazelcast.map.IMap<String,org.apache.camel.support.DefaultExchangeHolder> |
persistedCache |
protected String |
persistenceMapName |
protected long |
recoveryInterval |
protected boolean |
useLocalHzInstance |
protected boolean |
useRecovery |
| Constructor and Description |
|---|
HazelcastAggregationRepository(String repositoryName)
Creates new
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior and a local Hazelcast instance. |
HazelcastAggregationRepository(String repositoryName,
boolean optimistic)
Creates new
HazelcastAggregationRepository with recoverable behavior and a local Hazelcast instance. |
HazelcastAggregationRepository(String repositoryName,
boolean optimistic,
com.hazelcast.core.HazelcastInstance hzInstance)
Creates new
HazelcastAggregationRepository with recoverable behavior. |
HazelcastAggregationRepository(String repositoryName,
com.hazelcast.core.HazelcastInstance hzInstanse)
Creates new
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior. |
HazelcastAggregationRepository(String repositoryName,
String persistentRepositoryName)
Creates new
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior and a local Hazelcast instance. |
HazelcastAggregationRepository(String repositoryName,
String persistentRepositoryName,
boolean optimistic)
Creates new
HazelcastAggregationRepository with recoverable behavior and a local Hazelcast instance. |
HazelcastAggregationRepository(String repositoryName,
String persistentRepositoryName,
boolean optimistic,
com.hazelcast.core.HazelcastInstance hzInstance)
Creates new
HazelcastAggregationRepository with recoverable behavior. |
HazelcastAggregationRepository(String repositoryName,
String persistentRepositoryName,
com.hazelcast.core.HazelcastInstance hzInstanse)
Creates new
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior. |
| Modifier and Type | Method and Description |
|---|---|
org.apache.camel.Exchange |
add(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange) |
org.apache.camel.Exchange |
add(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange oldExchange,
org.apache.camel.Exchange newExchange) |
void |
confirm(org.apache.camel.CamelContext camelContext,
String exchangeId) |
boolean |
containsKey(Object key)
Checks if the key in question is in the repository.
|
protected void |
doStart() |
protected void |
doStop() |
org.apache.camel.Exchange |
get(org.apache.camel.CamelContext camelContext,
String key) |
String |
getDeadLetterUri() |
Set<String> |
getKeys() |
int |
getMaximumRedeliveries() |
String |
getPersistentRepositoryName() |
long |
getRecoveryIntervalInMillis() |
boolean |
isAllowSerializedHeaders() |
boolean |
isUseRecovery() |
org.apache.camel.Exchange |
recover(org.apache.camel.CamelContext camelContext,
String exchangeId) |
void |
remove(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange)
This method performs transactional operation on removing the
exchange from the operational storage and
moving it into the persistent one if the HazelcastAggregationRepository runs in recoverable mode and
optimistic is false. |
Set<String> |
scan(org.apache.camel.CamelContext camelContext) |
void |
setAllowSerializedHeaders(boolean allowSerializedHeaders) |
void |
setDeadLetterUri(String deadLetterUri) |
void |
setMaximumRedeliveries(int maximumRedeliveries) |
void |
setRecoveryInterval(long interval) |
void |
setRecoveryInterval(long interval,
TimeUnit timeUnit) |
void |
setUseRecovery(boolean useRecovery) |
protected org.apache.camel.Exchange |
unmarshallExchange(org.apache.camel.CamelContext camelContext,
org.apache.camel.support.DefaultExchangeHolder holder) |
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected static final String COMPLETED_SUFFIX
protected boolean optimistic
protected boolean useLocalHzInstance
protected boolean useRecovery
protected com.hazelcast.map.IMap<String,org.apache.camel.support.DefaultExchangeHolder> cache
protected com.hazelcast.map.IMap<String,org.apache.camel.support.DefaultExchangeHolder> persistedCache
protected com.hazelcast.core.HazelcastInstance hzInstance
protected String mapName
protected String persistenceMapName
protected String deadLetterChannel
protected long recoveryInterval
protected int maximumRedeliveries
protected boolean allowSerializedHeaders
public HazelcastAggregationRepository(String repositoryName)
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior and a local Hazelcast instance. Recoverable repository name defaults to repositoryName +
"-compeleted".repositoryName - IMap repository name;public HazelcastAggregationRepository(String repositoryName, String persistentRepositoryName)
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior and a local Hazelcast instance.repositoryName - IMap repository name;persistentRepositoryName - IMap recoverable repository name;public HazelcastAggregationRepository(String repositoryName, boolean optimistic)
HazelcastAggregationRepository with recoverable behavior and a local Hazelcast instance.
Recoverable repository name defaults to repositoryName + "-compeleted".repositoryName - IMap repository name;optimistic - whether to use optimistic locking manner.public HazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, boolean optimistic)
HazelcastAggregationRepository with recoverable behavior and a local Hazelcast instance.repositoryName - IMap repository name;persistentRepositoryName - IMap recoverable repository name;optimistic - whether to use optimistic locking manner.public HazelcastAggregationRepository(String repositoryName, com.hazelcast.core.HazelcastInstance hzInstanse)
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior. Recoverable repository name defaults to repositoryName + "-compeleted".repositoryName - IMap repository name;hzInstanse - externally configured HazelcastInstance.public HazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, com.hazelcast.core.HazelcastInstance hzInstanse)
HazelcastAggregationRepository that defaults to non-optimistic locking with recoverable
behavior.repositoryName - IMap repository name;persistentRepositoryName - IMap recoverable repository name;hzInstanse - externally configured HazelcastInstance.public HazelcastAggregationRepository(String repositoryName, boolean optimistic, com.hazelcast.core.HazelcastInstance hzInstance)
HazelcastAggregationRepository with recoverable behavior. Recoverable repository name
defaults to repositoryName + "-compeleted".repositoryName - IMap repository name;optimistic - whether to use optimistic locking manner;hzInstance - externally configured HazelcastInstance.public HazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, boolean optimistic, com.hazelcast.core.HazelcastInstance hzInstance)
HazelcastAggregationRepository with recoverable behavior.repositoryName - IMap repository name;optimistic - whether to use optimistic locking manner;persistentRepositoryName - IMap recoverable repository name;hzInstance - externally configured HazelcastInstance.public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange oldExchange,
org.apache.camel.Exchange newExchange)
throws org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException
add in interface org.apache.camel.spi.OptimisticLockingAggregationRepositoryorg.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingExceptionpublic org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange)
add in interface org.apache.camel.spi.AggregationRepositorypublic Set<String> scan(org.apache.camel.CamelContext camelContext)
scan in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext,
String exchangeId)
recover in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setRecoveryInterval(long interval,
TimeUnit timeUnit)
setRecoveryInterval in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setRecoveryInterval(long interval)
setRecoveryInterval in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic long getRecoveryIntervalInMillis()
getRecoveryIntervalInMillis in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setUseRecovery(boolean useRecovery)
setUseRecovery in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic boolean isUseRecovery()
isUseRecovery in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setDeadLetterUri(String deadLetterUri)
setDeadLetterUri in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic String getDeadLetterUri()
getDeadLetterUri in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic void setMaximumRedeliveries(int maximumRedeliveries)
setMaximumRedeliveries in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic int getMaximumRedeliveries()
getMaximumRedeliveries in interface org.apache.camel.spi.RecoverableAggregationRepositorypublic org.apache.camel.Exchange get(org.apache.camel.CamelContext camelContext,
String key)
get in interface org.apache.camel.spi.AggregationRepositorypublic boolean containsKey(Object key)
key - Object - key in questionpublic boolean isAllowSerializedHeaders()
public void setAllowSerializedHeaders(boolean allowSerializedHeaders)
public void remove(org.apache.camel.CamelContext camelContext,
String key,
org.apache.camel.Exchange exchange)
exchange from the operational storage and
moving it into the persistent one if the HazelcastAggregationRepository runs in recoverable mode and
optimistic is false. It will act at your own risk otherwise.remove in interface org.apache.camel.spi.AggregationRepositoryremove in interface org.apache.camel.spi.OptimisticLockingAggregationRepositorycamelContext - the current CamelContextkey - the correlation keyexchange - the exchange to removepublic void confirm(org.apache.camel.CamelContext camelContext,
String exchangeId)
confirm in interface org.apache.camel.spi.AggregationRepositorypublic Set<String> getKeys()
getKeys in interface org.apache.camel.spi.AggregationRepositorypublic String getPersistentRepositoryName()
IMap name;protected void doStart()
throws Exception
doStart in class org.apache.camel.support.service.BaseServiceExceptionprotected void doStop()
throws Exception
doStop in class org.apache.camel.support.service.BaseServiceExceptionprotected org.apache.camel.Exchange unmarshallExchange(org.apache.camel.CamelContext camelContext,
org.apache.camel.support.DefaultExchangeHolder holder)
Apache Camel