camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Burkard <sburk...@gmail.com>
Subject Re: Transacted test case with ActiveMQ not working
Date Thu, 26 Apr 2012 14:06:11 GMT
Can you give it a try to remove the whole broker-definition
(broker:broker) from your config a try again?

You are using the vm-transport-protocol and therefore, as I mentioned
in the last post, activemq creates automatically a broker. I also had
issues with missing messages as long as I had a broker-definition in
my config.



On Thu, Apr 26, 2012 at 15:56, javaxmlsoapdev <javaxmlsoapdev@yahoo.com> wrote:
> Thanks all for taking time in responding. However it still doesn't work for
> me. May some stupid mistake? Any other ideas?
>
> here is how my route definition looks like in Java DSL
>
> @Component
> public class CustomRouter extends SpringRouteBuilder{
>        @Autowired
>        private CustomQProcessor customQProcessor;
>
>    public void configure() {
>        String sourceQName ="";
>        try {
>                        sourceQName =
> getContext().resolvePropertyPlaceholders("{{sourceQ.name}}");
>                } catch (Exception e) {
>
>                        e.printStackTrace();
>                }
>                from(sourceQName)
>                .transacted()
>                .process(customQProcessor)
>                .recipientList(header("recepientList")).parallelProcessing();
>        }
> }
>
> config is as below.
>
> <broker:broker id="broker" useJmx="false" persistent="true"
> brokerName="localhost">
>                <broker:transportConnectors>
>                        <broker:transportConnector uri="vm://localhost:61616"/>
>                </broker:transportConnectors>
>        </broker:broker>
>
>        <bean id="jmsTransactionManager"
> class="org.springframework.jms.connection.JmsTransactionManager">
>        <property name="connectionFactory" ref="pooledConnectionFactory"/>
>        </bean>
>        <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="broker">
>                <property name="brokerURL" value="vm://localhost:61616" />
>        </bean>
>        <bean id="pooledConnectionFactory"
> class="org.apache.activemq.pool.PooledConnectionFactory">
>                <property name="maxConnections" value="5" />
>                <property name="connectionFactory" ref="jmsConnectionFactory"
/>
>        </bean>
>
>        <bean id="jmsConfig"
> class="org.apache.camel.component.jms.JmsConfiguration">
>                <property name="connectionFactory" ref="pooledConnectionFactory"
/>
>                <property name="transacted" value="true" />
>        </bean>
>
>        <bean id="activemq"
> class="org.apache.activemq.camel.component.ActiveMQComponent">
>                <property name="brokerURL" value="vm://localhost:61616"/>
>        </bean>
>
>
> Following is a test case which fails
>
> Endpoint sourceQendPoint = sourceQueue.getDefaultEndpoint();
>                RouteBuilder rb = new RouteBuilder(){
>                        public void configure() throws Exception{
>                                interceptSendToEndpoint("activemq:queue:destiQueue1")
>                                        .throwException(new JMSException("Cannot
publish to destiQueue1"));
>                        }
>                };
>                RouteDefinition eventRoute = camelContext.getRouteDefinition("route1");
>                eventRoute.adviceWith((ModelCamelContext)camelContext, rb);
>
>                template.sendBody(sourceQendPoint,"Test message");
>                Thread.sleep(3000);
>                Object body = consumer.receiveBodyNoWait("activemq:queue:ActiveMQ.DLQ");
>                assertNotNull("should not lose message",body);
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Transacted-test-case-with-ActiveMQ-not-working-tp5666012p5667684.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message