public final class HazelcastAggregationRepository
extends org.apache.camel.support.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.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) |
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 |
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 |
setDeadLetterUri(String deadLetterUri) |
void |
setMaximumRedeliveries(int maximumRedeliveries) |
void |
setRecoveryInterval(long interval) |
void |
setRecoveryInterval(long interval,
TimeUnit timeUnit) |
void |
setUseRecovery(boolean useRecovery) |
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.OptimisticLockingAggregationRepository
org.apache.camel.spi.OptimisticLockingAggregationRepository.OptimisticLockingException
public org.apache.camel.Exchange add(org.apache.camel.CamelContext camelContext, String key, org.apache.camel.Exchange exchange)
add
in interface org.apache.camel.spi.AggregationRepository
public Set<String> scan(org.apache.camel.CamelContext camelContext)
scan
in interface org.apache.camel.spi.RecoverableAggregationRepository
public org.apache.camel.Exchange recover(org.apache.camel.CamelContext camelContext, String exchangeId)
recover
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setRecoveryInterval(long interval, TimeUnit timeUnit)
setRecoveryInterval
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setRecoveryInterval(long interval)
setRecoveryInterval
in interface org.apache.camel.spi.RecoverableAggregationRepository
public long getRecoveryIntervalInMillis()
getRecoveryIntervalInMillis
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setUseRecovery(boolean useRecovery)
setUseRecovery
in interface org.apache.camel.spi.RecoverableAggregationRepository
public boolean isUseRecovery()
isUseRecovery
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setDeadLetterUri(String deadLetterUri)
setDeadLetterUri
in interface org.apache.camel.spi.RecoverableAggregationRepository
public String getDeadLetterUri()
getDeadLetterUri
in interface org.apache.camel.spi.RecoverableAggregationRepository
public void setMaximumRedeliveries(int maximumRedeliveries)
setMaximumRedeliveries
in interface org.apache.camel.spi.RecoverableAggregationRepository
public int getMaximumRedeliveries()
getMaximumRedeliveries
in interface org.apache.camel.spi.RecoverableAggregationRepository
public org.apache.camel.Exchange get(org.apache.camel.CamelContext camelContext, String key)
get
in interface org.apache.camel.spi.AggregationRepository
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.AggregationRepository
remove
in interface org.apache.camel.spi.OptimisticLockingAggregationRepository
camelContext
- 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.AggregationRepository
public Set<String> getKeys()
getKeys
in interface org.apache.camel.spi.AggregationRepository
public String getPersistentRepositoryName()
IMap
name;protected void doStart() throws Exception
doStart
in class org.apache.camel.support.ServiceSupport
Exception
Apache Camel