Class ReplicatedHazelcastAggregationRepository
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.processor.aggregate.hazelcast.HazelcastAggregationRepository
org.apache.camel.processor.aggregate.hazelcast.ReplicatedHazelcastAggregationRepository
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.AggregationRepository,org.apache.camel.spi.OptimisticLockingAggregationRepository,org.apache.camel.spi.RecoverableAggregationRepository,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
A Hazelcast-based AggregationRepository implementing
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
ReplicatedHazelcastAggregationRepository can run it's own Hazelcast instance, but obviously no benefits of Hazelcast
clustering are gained this way. If the ReplicatedHazelcastAggregationRepository uses it's own local
HazelcastInstance it will DESTROY this instance on HazelcastAggregationRepository.doStop(). You should control
HazelcastInstance lifecycle yourself whenever you instantiate
ReplicatedHazelcastAggregationRepository passing a reference to the instance.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.camel.spi.OptimisticLockingAggregationRepository
org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException -
Field Summary
FieldsModifier and TypeFieldDescriptionFields inherited from class org.apache.camel.processor.aggregate.hazelcast.HazelcastAggregationRepository
allowSerializedHeaders, cache, COMPLETED_SUFFIX, deadLetterUri, hazelcastInstance, mapName, maximumRedeliveries, optimistic, persistedCache, persistenceMapName, recoveryInterval, useLocalHzInstance, useRecoveryFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionReplicatedHazelcastAggregationRepository(String repositoryName) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior and a local Hazelcast instance.ReplicatedHazelcastAggregationRepository(String repositoryName, boolean optimistic) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior and a local Hazelcast instance.ReplicatedHazelcastAggregationRepository(String repositoryName, boolean optimistic, com.hazelcast.core.HazelcastInstance hzInstance) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior.ReplicatedHazelcastAggregationRepository(String repositoryName, com.hazelcast.core.HazelcastInstance hzInstanse) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior.ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior and a local Hazelcast instance.ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, boolean optimistic) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior and a local Hazelcast instance.ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, boolean optimistic, com.hazelcast.core.HazelcastInstance hzInstance) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior.ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, com.hazelcast.core.HazelcastInstance hzInstanse) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.camel.Exchangeorg.apache.camel.Exchangeadd(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange oldExchange, org.apache.camel.Exchange newExchange) voidbooleancontainsKey(Object key) Checks if the key in question is in the repository.protected voiddoStart()org.apache.camel.ExchangegetKeys()org.apache.camel.ExchangevoidThis method performs transactional operation on removing theexchangefrom the operational storage and moving it into the persistent one if theHazelcastAggregationRepositoryruns in recoverable mode andoptimisticis false.scan(org.apache.camel.CamelContext camelContext) Methods inherited from class org.apache.camel.processor.aggregate.hazelcast.HazelcastAggregationRepository
doStop, getDeadLetterUri, getHazelcastInstance, getMaximumRedeliveries, getPersistentRepositoryName, getRecoveryInterval, isAllowSerializedHeaders, isUseRecovery, setAllowSerializedHeaders, setDeadLetterUri, setHazelcastInstance, setMaximumRedeliveries, setRecoveryInterval, setRecoveryInterval, setUseRecovery, unmarshallExchangeMethods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.spi.RecoverableAggregationRepository
confirmWithResult, getRecoveryIntervalInMillisMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
replicatedCache
-
replicatedPersistedCache
-
-
Constructor Details
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository() -
ReplicatedHazelcastAggregationRepository
Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior and a local Hazelcast instance. Recoverable repository name defaults torepositoryName+ "-compeleted".- Parameters:
repositoryName-IMaprepository name;
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior and a local Hazelcast instance.- Parameters:
repositoryName-IMaprepository name;persistentRepositoryName-IMaprecoverable repository name;
-
ReplicatedHazelcastAggregationRepository
Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior and a local Hazelcast instance. Recoverable repository name defaults torepositoryName+ "-compeleted".- Parameters:
repositoryName-IMaprepository name;optimistic- whether to use optimistic locking manner.
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, boolean optimistic) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior and a local Hazelcast instance.- Parameters:
repositoryName-IMaprepository name;persistentRepositoryName-IMaprecoverable repository name;optimistic- whether to use optimistic locking manner.
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository(String repositoryName, com.hazelcast.core.HazelcastInstance hzInstanse) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior. Recoverable repository name defaults torepositoryName+ "-compeleted".- Parameters:
repositoryName-IMaprepository name;hzInstanse- externally configuredHazelcastInstance.
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, com.hazelcast.core.HazelcastInstance hzInstanse) Creates newReplicatedHazelcastAggregationRepositorythat defaults to non-optimistic locking with recoverable behavior.- Parameters:
repositoryName-IMaprepository name;persistentRepositoryName-IMaprecoverable repository name;hzInstanse- externally configuredHazelcastInstance.
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository(String repositoryName, boolean optimistic, com.hazelcast.core.HazelcastInstance hzInstance) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior. Recoverable repository name defaults torepositoryName+ "-compeleted".- Parameters:
repositoryName-IMaprepository name;optimistic- whether to use optimistic locking manner;hzInstance- externally configuredHazelcastInstance.
-
ReplicatedHazelcastAggregationRepository
public ReplicatedHazelcastAggregationRepository(String repositoryName, String persistentRepositoryName, boolean optimistic, com.hazelcast.core.HazelcastInstance hzInstance) Creates newReplicatedHazelcastAggregationRepositorywith recoverable behavior.- Parameters:
repositoryName-IMaprepository name;persistentRepositoryName-IMaprecoverable repository name;optimistic- whether to use optimistic locking manner;hzInstance- externally configuredHazelcastInstance.
-
-
Method Details
-
add
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 - Specified by:
addin interfaceorg.apache.camel.spi.OptimisticLockingAggregationRepository- Overrides:
addin classHazelcastAggregationRepository- Throws:
org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException
-
add
public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange) - Specified by:
addin interfaceorg.apache.camel.spi.AggregationRepository- Overrides:
addin classHazelcastAggregationRepository
-
scan
- Specified by:
scanin interfaceorg.apache.camel.spi.RecoverableAggregationRepository- Overrides:
scanin classHazelcastAggregationRepository
-
recover
public org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext, String exchangeId) - Specified by:
recoverin interfaceorg.apache.camel.spi.RecoverableAggregationRepository- Overrides:
recoverin classHazelcastAggregationRepository
-
get
- Specified by:
getin interfaceorg.apache.camel.spi.AggregationRepository- Overrides:
getin classHazelcastAggregationRepository
-
containsKey
Checks if the key in question is in the repository.- Overrides:
containsKeyin classHazelcastAggregationRepository- Parameters:
key- Object - key in question
-
remove
public void remove(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange) This method performs transactional operation on removing theexchangefrom the operational storage and moving it into the persistent one if theHazelcastAggregationRepositoryruns in recoverable mode andoptimisticis false. It will act at your own risk otherwise.- Specified by:
removein interfaceorg.apache.camel.spi.AggregationRepository- Specified by:
removein interfaceorg.apache.camel.spi.OptimisticLockingAggregationRepository- Overrides:
removein classHazelcastAggregationRepository- Parameters:
camelContext- the current CamelContextkey- the correlation keyexchange- the exchange to remove
-
confirm
- Specified by:
confirmin interfaceorg.apache.camel.spi.AggregationRepository- Overrides:
confirmin classHazelcastAggregationRepository
-
getKeys
- Specified by:
getKeysin interfaceorg.apache.camel.spi.AggregationRepository- Overrides:
getKeysin classHazelcastAggregationRepository
-
doStart
- Overrides:
doStartin classHazelcastAggregationRepository- Throws:
Exception
-