You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Adam Sherman <ad...@sherman.ca> on 2007/10/12 16:18:43 UTC

Advice Needed on Design

Good Morning All,

I am in the process of designing my first project using JMS. So far,  
I am using the Spring XBean support and ActiveMQ 5.0-SNAPSHOT to  
exchange some simple messages between two network nodes to get my  
feet wet and start understanding all the components.

I am now looking for some advice on how to architect this application  
and am hoping the list can help me out! :-)

The requirements:

- multiple nodes sending "process this data" messages ("web node")
- multiple nodes consuming the above messages and doing work  
("processor node")
- processor nodes broadcast messages containing status updates which  
need to cause things like email notifications and various other data  
updates

Basically, I am designing a special-purpose video site where users  
upload video and it gets processed. The users need to receive a lot  
of progress information.

How can I have a variety of "listeners" for a event-style message  
(like "processing complete") but only have one of them process the  
message? (e.g. I have a pool of consumers that send notification  
emails, another pool that updates a status page and will eventually  
add more.) My understanding of "topics" is that you can't force only  
a single subscriber to handle each message.

Any thoughts/comments/suggestions you can provide would be very helpful.

Thank you,

A.

-- 
Adam Sherman
Technologist
+1 (613) 797-6819 | http://www.sherman.ca/ | sip:adam@sherman.ca




Re: Advice Needed on Design

Posted by James Strachan <ja...@gmail.com>.
On 12/10/2007, Adam Sherman <ad...@sherman.ca> 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

Re: Advice Needed on Design

Posted by Adam Sherman <ad...@sherman.ca>.
(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:adam@sherman.ca




Re: Advice Needed on Design

Posted by Adam Sherman <ad...@sherman.ca>.
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:adam@sherman.ca




Re: Advice Needed on Design

Posted by Adam Sherman <ad...@sherman.ca>.
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...

Wow, that is a lot of new docs to read. :-|

I'm not clear on what Camel actually is though. Going to go watch  
your screencast now.

A.


-- 
Adam Sherman
Technologist
+1 (613) 797-6819 | http://www.sherman.ca/ | sip:adam@sherman.ca




Re: Advice Needed on Design

Posted by James Strachan <ja...@gmail.com>.
On 12/10/2007, Adam Sherman <ad...@sherman.ca> wrote:
> Good Morning All,

Welcome Adam!


> I am in the process of designing my first project using JMS. So far,
> I am using the Spring XBean support and ActiveMQ 5.0-SNAPSHOT to
> exchange some simple messages between two network nodes to get my
> feet wet and start understanding all the components.
>
> I am now looking for some advice on how to architect this application
> and am hoping the list can help me out! :-)
>
> The requirements:
>
> - multiple nodes sending "process this data" messages ("web node")
> - multiple nodes consuming the above messages and doing work
> ("processor node")
> - processor nodes broadcast messages containing status updates which
> need to cause things like email notifications and various other data
> updates
>
> Basically, I am designing a special-purpose video site where users
> upload video and it gets processed. The users need to receive a lot
> of progress information.
>
> How can I have a variety of "listeners" for a event-style message
> (like "processing complete") but only have one of them process the
> message? (e.g. I have a pool of consumers that send notification
> emails, another pool that updates a status page and will eventually
> add more.) My understanding of "topics" is that you can't force only
> a single subscriber to handle each message.
>
> Any thoughts/comments/suggestions you can provide would be very helpful.
>
> Thank you,

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...

http://activemq.apache.org/camel/bean-integration.html

it basically means you can create a messaging application without
writing any JMS code; you'd also be transport agnostic allowing you to
switch between various kinds of protocol if you need it later on..

http://activemq.apache.org/camel/components.html

e.g. start off writing interfaces for your remote services (such as
the send data interface)

then start with spring remoting; which lets you bind the interface to
a queue for load balancing or topic for publish subscribe; then the
server side would consume the messages etc.

http://activemq.apache.org/camel/spring-remoting.html
-- 
James
-------
http://macstrac.blogspot.com/

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