HazelcastIdempotentRepository using existing Hazelcast service on Fuse/Fabric
Issue
I have a working camel HazelcastIdempotentRepository example as follows:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="idempotentRepoHazel"
class="org.apache.camel.processor.idempotent.hazelcast.HazelcastIdempotentRepository">
<argument ref="hazelcast" />
<argument value="repo" />
</bean>
<bean id="hazelcast" class="com.hazelcast.core.Hazelcast"
factory-method="newHazelcastInstance">
<argument>
<null />
</argument>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="direct:start"/>
<log message="------------------- Original message received -- body=${body}"/>
<setHeader headerName="messageId">
<simple>${body}</simple>
</setHeader>
<idempotentConsumer messageIdRepositoryRef="idempotentRepoHazel" skipDuplicate="false">
<header>messageId</header>
<filter>
<property>CamelDuplicateMessage</property>
<to uri="mock:duplicate"/>
<stop/>
</filter>
<log message="+++++++++++++++++++++++++ Message received through filter -- body=${body}"/>
<to uri="mock:result"/>
</idempotentConsumer>
</route>
</camelContext>
</blueprint>
Now, as can be seen, this example creates a new Hazelcast instance of its own. This is not optimal.
I am wondering if you have an example as such that the HazelcastIdempotentRepository refers to an existing Hazelcast service instance/repo (ideally unified one that is shared by all containers in a same fabric)?
Environment
- Red Hat JBoss Fuse 6.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.