Hi everybody,

I am trying to implement Request reply EIP using JMS and succeded quite
easily, thanks to Camel power :-D
Now I find myself in a strange situation: I need to implement this pattern
where I have one request message and possibly more than one reply,
correlated to the original request.
Is it possible with Camel and, in general, is it possible with JMS using
reply-to-queue and correlationId?

Plus: I found that even with a very simple configuration, the message
exchange is quite slow: average 1 second starting from a cxf endpoint and
without exiting from Camel. Here is my configuration:

<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:cxf="http://camel.apache.org/schema/cxf";
        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
        http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd";
    >
    
    <import resource="classpath:META-INF/cxf/cxf.xml" />
        <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
        <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
        
        <import resource="classpath:activemq-config.xml" />

        <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
                <route>
                        <from
uri="cxf:bean:gtEndpoint?serviceName={http://www.my.com}gt_connector"/>
                        <to uri="jms:gtIn?replyTo=gtOut" />
                </route>
                <route>
                        <from uri="jms:gtIn" />
                        <to uri="bean:gtMessageProcessor" />
                        <to uri="jms:gtOut" />
                </route>
        </camelContext>
        
        <cxf:cxfEndpoint
                id="gtEndpoint" address="/gt"
                serviceClass="my.com.gt.GtConnector"
                wsdlURL="wsdl/gt_connector.wsdl"
        />
        
        <bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
                <property name="connectionFactory" 
ref="pooledJmsConnectionFactory" />
                
        </bean>
        
        <bean id="gtMessageProcessor"
                  class="my.com.gt.GTMessageProcessor" />
</beans>

The bean is very simple, it just reads the request message and replies with
a constant string. The second route is just to mock the actual service.

This is my ActiveMQ configuration:

<beans xmlns="http://www.springframework.org/schema/beans";
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
           xmlns:amq="http://activemq.apache.org/schema/core";
           xsi:schemaLocation="
                http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
                http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd";>

        <amq:broker useJmx="true" persistent="true" start="true">
                <amq:transportConnectors>
                        <amq:transportConnector uri="tcp://localhost:61616" />
                </amq:transportConnectors>
        </amq:broker>

        <amq:queue id="gtIn" name="GT.IN" physicalName="GT.IN" />
        <amq:queue id="gtOut" name="GT.OUT" physicalName="GT.OUT" />

        <bean id="pooledJmsConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
                destroy-method="stop">
                <property name="connectionFactory">
                        <amq:connectionFactory brokerURL="tcp://localhost:61616"
                                id="jmsConnectionFactory" />
                </property>
        </bean>
 
        <bean id="jmsTransactionManager"
                
class="org.springframework.jms.connection.JmsTransactionManager">
                <property name="connectionFactory" 
ref="pooledJmsConnectionFactory" />
        </bean>
 
</beans>

Thanks in advance

Alberto

-- 
View this message in context: 
http://old.nabble.com/Request-reply-pattern-with-JMS-and-more-replies-to-one-request-tp27907444p27907444.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to