Re: Advice Needed on Design

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Advice Needed on Design

Adam Sherman
(Thought I should switch lists.)

On Oct 12, 2007, at 13:09, Adam Sherman wrote:
> On Oct 12, 2007, at 10:31, James Strachan wrote:
>> To get things going and to avoid you having to worry about how to use
>> the JMS API properly and so forth I'd recommend you experiment with
>> the Bean Integration in Camel...
>
> I'm not clear on what Camel actually is though. Going to go watch  
> your screencast now.

Ok, I'm trying to wrap my head around it.

I currently configure ActiveMQ as follows:

     <!-- JMS Broker -->
     <amq:broker id="broker1" useJmx="false" persistent="false">
         <amq:transportConnectors>
             <amq:transportConnector uri="tcp://localhost:61616?
trace=true" />
         </amq:transportConnectors>
     </amq:broker>

     <!-- JMS ConnectionFactory to use, configuring the embedded  
broker using XML -->
     <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost?
create=false" />

     <amq:queue id="destination"  
physicalName="com.dotsub.tcms.destination"/>

Where "destination" is my first test destination.

Then I use Spring's MessageListenerAdapter to get messages into my POJO:

        <bean id="convertMessageListener"  
class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
            <constructor-arg>
                <bean  
class="com.dotsub.tcms.processor.ConvertMessageListenerImpl">
                    <property name="videoConverter"  
ref="videoConverter" />
                </bean>
            </constructor-arg>
        </bean>

        <bean id="convertMessageListenerContainer"
           
class="org.springframework.jms.listener.DefaultMessageListenerContainer"
  depends-on="jmsFactory">
          <property name="concurrentConsumers" value="1"/>
          <property name="connectionFactory" ref="jmsFactory" />
          <property name="destination" ref="destination" />
          <property name="messageListener"  
ref="convertMessageListener" />
        </bean>

For sending messages to the videoConverter I just use Spring's  
JmsTemplate.convertAndSend() method.

Can you please quickly sketch out what I would do to use Camel here?

Thank you very much for your assistance.

A.

--
Adam Sherman
Technologist
+1 (613) 797-6819 | http://www.sherman.ca/ | sip:[hidden email]



Reply | Threaded
Open this post in threaded view
|

Re: Advice Needed on Design

jstrachan
On 12/10/2007, Adam Sherman <[hidden email]> wrote:
> (Thought I should switch lists.)

:)

> On Oct 12, 2007, at 13:09, Adam Sherman wrote:
> > On Oct 12, 2007, at 10:31, James Strachan wrote:
> >> To get things going and to avoid you having to worry about how to use
> >> the JMS API properly and so forth I'd recommend you experiment with
> >> the Bean Integration in Camel...
> >
> > I'm not clear on what Camel actually is though. Going to go watch
> > your screencast now.
>
> Ok, I'm trying to wrap my head around it.
>
> I currently configure ActiveMQ as follows:
>
>      <!-- JMS Broker -->
>      <amq:broker id="broker1" useJmx="false" persistent="false">
>          <amq:transportConnectors>
>              <amq:transportConnector uri="tcp://localhost:61616?
> trace=true" />
>          </amq:transportConnectors>
>      </amq:broker>
>
>      <!-- JMS ConnectionFactory to use, configuring the embedded
> broker using XML -->
>      <amq:connectionFactory id="jmsFactory" brokerURL="vm://localhost?
> create=false" />
>
>      <amq:queue id="destination"
> physicalName="com.dotsub.tcms.destination"/>
>
> Where "destination" is my first test destination.
>
> Then I use Spring's MessageListenerAdapter to get messages into my POJO:
>
>         <bean id="convertMessageListener"
> class="org.springframework.jms.listener.adapter.MessageListenerAdapter">
>             <constructor-arg>
>                 <bean
> class="com.dotsub.tcms.processor.ConvertMessageListenerImpl">
>                     <property name="videoConverter"
> ref="videoConverter" />
>                 </bean>
>             </constructor-arg>
>         </bean>
>
>         <bean id="convertMessageListenerContainer"
>
> class="org.springframework.jms.listener.DefaultMessageListenerContainer"
>   depends-on="jmsFactory">
>           <property name="concurrentConsumers" value="1"/>
>           <property name="connectionFactory" ref="jmsFactory" />
>           <property name="destination" ref="destination" />
>           <property name="messageListener"
> ref="convertMessageListener" />
>         </bean>
>
> For sending messages to the videoConverter I just use Spring's
> JmsTemplate.convertAndSend() method.
>
> Can you please quickly sketch out what I would do to use Camel here?\

There's a test case here - using trunk - of Camel to use the <proxy>
and <export> elements with Camel to create a client side proxy or
server side export of a service - using JMS as the transport.

This now supports request/response over JMS (using JMSReplyTo on the
message so the server knows how to reply and the client side uses a
temporary queue for responses.

http://svn.apache.org/repos/asf/activemq/camel/trunk/components/camel-jms/src/test/resources/org/apache/camel/component/jms/remoting/spring.xml

--
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com