Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-9883

Add a SpringCache based idempotent repository

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 2.17.1, 2.18.0
    • camel-spring
    • None
    • Novice

    Description

      It may be useful to have a spring-cache based idempotent repository to ease the configuration of idempotent repository in spring xml based projects.

      i.e.

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="
           http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans.xsd
           http://camel.apache.org/schema/spring
           http://camel.apache.org/schema/spring/camel-spring.xsd">
      
        <bean id="cacheManager" class="org.infinispan.spring.provider.SpringRemoteCacheManagerFactoryBean">
          <property
              name="configurationProperties">
            <props>
              <prop key="infinispan.client.hotrod.server_list">127.0.0.1:11222</prop>
              <prop key="infinispan.client.hotrod.force_return_values">true</prop>
            </props>
          </property>
        </bean>
      
        <bean id="repo" class="org.apache.camel-spring.SpringCacheIdempotentRepository">
          <constructor-arg ref="cacheManager"/>
          <constructor-arg value="idempotent"/>
        </bean>
      
        <camelContext xmlns="http://camel.apache.org/schema/spring">
          <route id="infinispan-remote">
            <from uri="direct:start" />
            <idempotentConsumer messageIdRepositoryRef="repo" skipDuplicate="true">
              <header>MessageId</header>
              <to uri="log:camel?level=INFO&amp;showAll=true&amp;multiline=true" />
            </idempotentConsumer>
          </route>
        </camelContext>
      
      </beans>
      

      Attachments

        Activity

          People

            lb Luca Burgazzoli
            lb Luca Burgazzoli
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: