THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
First, we need to create a cacheManager and then configure our
...
our org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository:
Code Block | ||||
---|---|---|---|---|
| ||||
<bean id="cacheManager" class="org.infinispan.manager.DefaultCacheManager" init-method="start" destroy-method="stop"/> <bean id="infinispanRepo" class="org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository" factory-method="infinispanIdempotentRepository"> <argument ref="cacheManager"/> <argument value="idempotent"/> </bean> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="JpaMessageIdRepositoryTest">
<from uri="direct:start" />
<idempotentConsumer messageIdRepositoryRef="infinispanStore">
<header>messageId</header>
<to uri="mock:result" />
</idempotentConsumer>
</route>
</camelContext>
|
If you plan to use a RemoteCacheManager instead of DefaultcacheManager please note that you need to force the cache to return values for Map oeprations:
Code Block | ||
---|---|---|
| ||
RemoteCacheManager manager = new RemoteCacheManager( new ConfigurationBuilder() .addServers("localhost") .forceReturnValues(true) .build(), true ); context.addRoutes(new RouteBuilder() { void configure() { from("direct:start") .idempotentConsumer( header("MessageID"), new InfinispanIdempotentRepository(manager, "idempotent")) .to("mock:result"); } }); |
For more information, see these resources...
...