You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Scisci <fe...@gmail.com> on 2017/01/16 16:48:59 UTC
Infinispan Idempotent - EAP Cluster mod
Hi,
I've a problem with Idempotent, the route is deployed on a EAP7 server on
cluster mode ( 2 servers active ).
The idempotent doesn't work. The file is process from the two server. Why?
Can someone help me please ?
Thanks
Mirko
<route customId="true" id="Ricezione_Flusso">
<from
uri="{{net_protocol}}://{{ftp_user}}@{{ftp_host}}:{{ftp_port}}/{{ftp_path}}?password={{ftp_password}}&fileName=${bean:Genera_File.Crea_Nome_File}&scheduler=quartz2&scheduler.cron=0+38+17+?+*+MON-FRI&noop=true&idempotent=true&idempotentRepository=#infinispanRepo&idempotentKey=${file:name}&readLock=idempotent&delay=2000"/>
<doTry>
<log message="Processing File: ${file:name}"/>
<setHeader headerName="filename">
<simple>${file:name}</simple>
</setHeader>
<unmarshal>
<bindy classType="XXXX_CSV" locale="en-us" type="Csv"/>
</unmarshal>
<process ref="BancaImi_Processor"/>
<doCatch >
<exception>java.lang.Exception</exception>
<log message="${exception}"/>
</doCatch>
</doTry>
</route>
<bean id="cacheManagerFactory"
class="org.infinispan.spring.provider.SpringRemoteCacheManagerFactoryBean">
<property name="configurationProperties">
<props>
<prop
key="infinispan.client.hotrod.server_list">10.0.0.78:11222</prop>
<prop key="infinispan.client.hotrod.force_return_values">true</prop>
</props>
</property>
</bean>
<bean id="cacheManager" factory-bean="cacheManagerFactory"
factory-method="getNativeCacheManager" init-method="start"
destroy-method="stop">
</bean>
<bean id="infinispanRepo"
class="org.apache.camel.component.infinispan.processor.idempotent.InfinispanIdempotentRepository"
factory-method="infinispanIdempotentRepository">
<constructor-arg ref="cacheManager"/>
<constructor-arg value="Idempotent_Emir"/>
</bean>
--
View this message in context: http://camel.465427.n5.nabble.com/Infinispan-Idempotent-EAP-Cluster-mod-tp5792581.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Infinispan Idempotent - EAP Cluster mod
Posted by Scisci <fe...@gmail.com>.
For more clarity, I'm using camel 2.18.1 and a remote infinispan server
connect by hotrod (version 8.2.5).
This is the config cache
<local-cache name="Idempotent_Emir">
<locking isolation="READ_COMMITTED"
acquire-timeout="30000" concurrency-level="1000" striping="false"/>
<transaction locking="PESSIMISTIC"/>
<eviction strategy="LRU" type="COUNT" size="10"/>
<security/>
</local-cache>
Thanks
Mirko
--
View this message in context: http://camel.465427.n5.nabble.com/Infinispan-Idempotent-EAP-Cluster-mod-tp5792581p5792680.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Infinispan Idempotent - EAP Cluster mod
Posted by Scisci <fe...@gmail.com>.
Hi,
after some try, I think I've found the error.
It seems that the idempotentkey on file endpoint doesn't work as expected.
With this route the key is never found
<from
uri="{{net_protocol}}://{{ftp_imi_user}}@{{ftp_imi_host}}:{{ftp_imi_port}}/{{ftp_imi_path}}?password={{ftp_imi_password}}&fileName=${bean:Genera_File_Imi.Crea_Nome_File}&scheduler=quartz2&scheduler.cron=0+28+17+?+*+MON-FRI&noop=true&idempotent=true&idempotentRepository=#infinispanRepo&idempotentKey=${file:onlyname.noext}&readLock=idempotent&delay=2000"/>
<doTry>
<log message="Processing File: ${file:name}"/>
<setHeader headerName="filename">
<simple>${file:name}</simple>
</setHeader>
<setHeader headerName="CamelInfinispanKey"
id="route-header-infinispan-key">
<simple>${file:onlyname.noext}</simple>
</setHeader>
<setHeader headerName="CamelInfinispanOperation"
id="route-header-infinispan-operation">
<constant>CamelInfinispanOperationGet</constant>
</setHeader>
<setHeader headerName="CamelInfinispanCacheName">
<simple>Idempotent_Emir</simple>
</setHeader>
<to id="route-infinispan-cache-lookup"
uri="infinispan:remote?cacheContainer=#cacheManager&cacheName=Idempotent_Emir"/>
<choice id="route-cache-choice">
<when id="route-cache-hit">
<simple>${header.CamelInfinispanOperationResult} != null</simple>
<log id="route-log-hit" message="CACHE LOOKUP NAME
${header.CamelInfinispanCacheName} : entry for key
${header.CamelInfinispanKey} is: ${header.CamelInfinispanOperationResult}"/>
</when>
<otherwise id="route-cache-miss">
<log id="route-log-miss" message="CACHE LOOKUP NAME
${header.CamelInfinispanCacheName} : no entry for key
${header.CamelInfinispanKey}"/>
</otherwise>
</choice>
...
Put the idempotent out of file endpoint it work ...
<from
uri="{{net_protocol}}://{{ftp_imi_user}}@{{ftp_imi_host}}:{{ftp_imi_port}}/{{ftp_imi_path}}?password={{ftp_imi_password}}&fileName=${bean:Genera_File_Imi.Crea_Nome_File}&scheduler=quartz2&scheduler.cron=0+0+18+?+*+MON-FRI&noop=true"/>
<idempotentConsumer id="route-idempotent-repository"
messageIdRepositoryRef="infinispanRepo">
<simple>${file:onlyname.noext}</simple>
<doTry>
<log message="Processing File: ${file:name}"/>
....
Bye
Mirko
--
View this message in context: http://camel.465427.n5.nabble.com/Infinispan-Idempotent-EAP-Cluster-mod-tp5792581p5792714.html
Sent from the Camel - Users mailing list archive at Nabble.com.