事务不能与activemq + spring-integration + spring-jms一起使用

时间:2016-10-11 17:50:10

标签: spring transactions apache-camel activemq

我的队列没有得到交易。我希望我的消息应该再次排队,如果发生任何错误但是消息没有得到处理(或者不会再次进入队列) 下面是我的驼峰配置文件

                               

<bean id="txManager"
    class="org.springframework.jms.connection.JmsTransactionManager">
    <property name="connectionFactory" ref="amqConnectionFactory" />
</bean>

<bean id="jasypt"
    class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
    <property name="password" value="*****" />
</bean>
<bean id="bridgePropertyPlaceholder"
    class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">
    <property name="location" value="classpath:jms-to-sql.cfg" />
    <property name="parser" ref="jasypt" />
</bean>
<bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
    <property name="brokerURL" value="${karaf-local.url}" />
    <property name="userName" value="${karaf-local.userName}" />
    <property name="password" value="${karaf-local.passwordEncrypted}" />
</bean>

<bean id="addAuthKey" class="com.xxx.addingAuthKey" />

<bean id="VadictRedeliveryPolicy" class="org.apache.camel.processor.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="${maximumRedeliveries}" />
    <property name="retryAttemptedLogLevel" value="ERROR" />
    <property name="redeliveryDelay" value="${redeliveryDelayMilliSeconds}" />
    <property name="retriesExhaustedLogLevel" value="ERROR" />
    <property name="logStackTrace" value="true" />
    <property name="backOffMultiplier" value="2" />
    <property name="useExponentialBackOff" value="true" />
    <property name="logExhaustedMessageHistory" value="true"/>
    <property name="logExhaustedMessageBody" value="true"/> 
</bean>

<bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
    <property name="deadLetterUri" value="jms:queue:{{karaf-local.queue}}&#58;{{DLCName}}" /> 
    <property name="redeliveryPolicy" ref="redeliveryPolicy" />
</bean>


<camelContext xmlns="http://camel.apache.org/schema/spring"
    trace="true">

        <route id="vadictQueue">
        <from
            uri="jms:{{karaf-local.queue}}?connectionFactory=#amqConnectionFactory" />
        <transacted/>
        <setProperty propertyName="api-username">
            <simple>{{api-username}}</simple>
        </setProperty>
        <setProperty propertyName="api-password">
            <simple>{{api-password}}</simple>
        </setProperty>
        <setProperty propertyName="grant_type">
            <simple>{{grant_type}}</simple>
        </setProperty>
        <setProperty propertyName="scope">
            <simple>{{scope}}</simple>
        </setProperty>
        <setProperty propertyName="client_secret">
            <simple>{{client_secret}}</simple>
        </setProperty>
        <setProperty propertyName="client_id">
            <simple>{{client_id}}</simple>
        </setProperty>          
        <setProperty propertyName="login_URL">
            <simple>{{login_URL}}</simple>
        </setProperty>          
        <setProperty propertyName="searchURL">
            <simple>{{searchURL}}</simple>
        </setProperty>
        <setProperty propertyName="assetGroupId">
            <simple>{{assetGroupId}}</simple>
        </setProperty>
        <process ref="addAuthKey" />

        <to uri="http://127.0.0.1:8080/api/measurement-events" />

    </route>
</camelContext>

0 个答案:

没有答案