camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leber, Thomas" <thomas.le...@omnetric.com>
Subject Routing Slip + InOutPattern + Transaction does not work
Date Thu, 02 Mar 2017 11:48:11 GMT
Hi,

I'm trying to use a Routing Slip with the InOut pattern. Also I have the requirement to transact
the whole system. I have set up a small example but I won't run.
The message stays inside the "producer" queue and will not be Picked up by the "_route1" or
"_route2".

When I'm commenting the line "<property name="transacted" value="true" />" from the
ActiveMq Component, it works fine, but then nothing is transacted.

Also the line: <setExchangePattern id="_setExchangePattern1" pattern="InOnly" /> does
not reset the JMSReply to header, so every other following queue will try to send a reply
to this temp queue.

Any ideas how to solve 
a. that I can user Transaction, InOut Pattern and a routing slip.
b. that the JMSReply header is reset. I know I can use removeHeaders, but it looks a bit as
a bug for me...

Best,
Thomas

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:amq="http://activemq.org/config/1.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://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">
	<!-- Active MQ General Properties -->
	<bean id="policy" class="org.apache.activemq.RedeliveryPolicy">
		<property name="maximumRedeliveries" value="-1" />
	</bean>

	<!-- Active MQ Properties Z-SM -->
	<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
		<property name="connectionFactory" ref="activemq-factory" />
	</bean>

	<bean id="required" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
		<property name="transactionManager" ref="jmsTransactionManager" />
		<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED" />
	</bean>

	<bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
		<property name="connectionFactory" ref="activemq-factory" />
		<property name="transacted" value="true" />
	</bean>

	<bean class="org.apache.activemq.ActiveMQConnectionFactory" id="activemq-factory">
		<property name="brokerURL" value="tcp://localhost:61617" />
		<property name="userName" value="admin" />
		<property name="password" value="admin" />
	</bean>

	<!-- Property configuration -->
	<cm:property-placeholder id="placeholder" persistent-id="routeconfig-routeslipconfig"
update-strategy="reload">
		<cm:default-properties>
			<cm:property name="routing.slip" value="activemq:queue:ExcutionProcessA,activemq:queue:ExcutionProcessB"
/>
		</cm:default-properties>
	</cm:property-placeholder>
	
	<camelContext id="routingSlipContext" xmlns="http://camel.apache.org/schema/blueprint">
		<propertyPlaceholder id="properties" location="blueprint:placeholder" />

		<route id="producer">
			<from id="_from1" uri="timer:mytimer?delay=2000" />
			<transacted ref="required" />
			<to uri="activemq:queue:producer" />
		</route>

		<route id="routingSlip">
			<from uri="activemq:queue:producer" />
			<setBody id="_setBody1">
				<simple>asdf</simple>
			</setBody>
			<setHeader headerName="queue1">
				<simple>ExcutionProcessA</simple>
			</setHeader>
			<setHeader headerName="queue2">
				<simple>ExcutionProcessB</simple>
			</setHeader>
			<setExchangePattern id="_setExchangePattern1" pattern="InOut" />
			<routingSlip id="_routingSlip1">
				<simple>activemq:queue:${header.queue1},activemq:queue:${header.queue2}</simple>
			</routingSlip>
			<setBody id="_setBody5">
				<simple>${body} -&gt; main route</simple>
			</setBody>
			<setExchangePattern id="_setExchangePattern1" pattern="InOnly" />
			<log id="_log1" message="${body}" />
			<log id="_log2" message="$simple{headers}" />
			<to id="_to1" uri="activemq:queue:output" />
		</route>

		<route id="mocker">
			<from uri="activemq:queue:output" />
			<to uri="mock:done" />
		</route>

		<route id="_route1">
			<from id="_from2" uri="activemq:queue:ExcutionProcessA" />
			<setBody id="_setBody2">
				<simple>${body} -&gt; route 1</simple>
			</setBody>
			<log id="_log3" message="consumer 2" />
			<setHeader headerName="route1" id="_setHeader1">
				<simple>yeah!</simple>
			</setHeader>
		</route>

		<route id="_route2">
			<from id="_from3" uri="activemq:queue:ExcutionProcessA" />
			<setBody id="_setBody3">
				<simple>${body} -&gt; route 1</simple>
			</setBody>
			<log id="_log4" message="consumer 1" />
			<setHeader headerName="route1" id="_setHeader2">
				<simple>yeah!</simple>
			</setHeader>
		</route>

		<route id="_route3">
			<from id="_from4" uri="activemq:queue:ExcutionProcessB" />
			<setBody id="_setBody4">
				<simple>${body} -&gt; route 2</simple>
			</setBody>
			<setHeader headerName="route2" id="_setHeader3">
				<simple>yeah!</simple>
			</setHeader>
		</route>
	</camelContext>
</blueprint>

Mime
View raw message