You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Juan Backson <ju...@gmail.com> on 2008/10/30 09:40:49 UTC

Question about implementing ActiveMQ

Hi,

I am new to ActiveMQ and after reading through activeMQ's documentation, I
realize that there are multiple ways of deploying ActiveMQ.

In my system, I have a backend server which would fire off STOMP messages to
ActiveMQ.  I have two ways to consume messages: one via java code and the
other one via AJAX.  For the Java consumer, it would be best if I can have
it hooked up somehow with ActiveMQ so I don't need to start a seperate
process.   The Java code would store the messages into DB and AJAX would
publish the messages to the web UI.

Given this setting, what is the best way of deploying ActiveMQ?  Should I
deploy activeMQ within Jetty using Spring and deploy my Java code as bean?

Any suggestion will be greatly appreciated.

Thanks in advance for all your help.

JB

Re: Question about implementing ActiveMQ

Posted by Juan Backson <ju...@gmail.com>.
Hi,

I was able to get a small test program written to send STOMP message
to activemq and able to receive the message from Telnet.  What I want
to do next is to change the receiving side from a Telnet client to a
java POJO.   What this POJO is going to do is just to read the STOMP
message and filter it and then store it to the Database.   Is this how
I should define camel in activemq.xml?

 <route>
            <from uri="activemq:queue:queuename"/>
            <to uri="bean:com.my.path.Pojo/process"/>
</route>

package com.my.path


public class Pojo{
    public void process(String name) {
    ...
  }
}

Thanks alot in adavance for all your help.

JB

Re: Question about implementing ActiveMQ

Posted by James Strachan <ja...@gmail.com>.
2008/10/30 Juan Backson <ju...@gmail.com>:
> Hi,
> Thank you for your prompt response.  For the Java consumer, it will need to
> do some DB processing, including removing a row from one table and then
> adding another row to another table.  What to insert and remove depend on
> the content of the message received.  I studied Camel, and it seems like
> there is a Bean component which allows me to use POJO to do some processing
> based on the message received.  Since it is more than purely storing
> messages to DB, I am not sure if iBates can be used.
>
> I see it is possible to write a Camel standalone app to listen on the topic,
> but is it also possible to run it as some kind of hook to ActiveMQ so that I
> don't need to manage an additional process?

Yes - see the activemq.xml file that comes with the ActiveMQ
distribution - search for "camelContext" and you'll see an example
routing rule included in the broker

> I am going to run ActiveMQ inside jetty as a war file, as Jetty is already
> part of my system already.  If I deploy ActiveMQ as a war inside Jetty, can
> I still fire STOMP message to ActiveMQ?

Yes

> Also, is it possible to deploy
> Camel Bean component within Jetty as well?

Yes
http://activemq.apache.org/camel/tutorial-on-using-camel-in-a-web-application.html
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Question about implementing ActiveMQ

Posted by Juan Backson <ju...@gmail.com>.
Hi,
Thank you for your prompt response.  For the Java consumer, it will need to
do some DB processing, including removing a row from one table and then
adding another row to another table.  What to insert and remove depend on
the content of the message received.  I studied Camel, and it seems like
there is a Bean component which allows me to use POJO to do some processing
based on the message received.  Since it is more than purely storing
messages to DB, I am not sure if iBates can be used.

I see it is possible to write a Camel standalone app to listen on the topic,
but is it also possible to run it as some kind of hook to ActiveMQ so that I
don't need to manage an additional process?

I am going to run ActiveMQ inside jetty as a war file, as Jetty is already
part of my system already.  If I deploy ActiveMQ as a war inside Jetty, can
I still fire STOMP message to ActiveMQ?  Also, is it possible to deploy
Camel Bean component within Jetty as well?

Thanks again for all your great help.

Regards,
JB




On Thu, Oct 30, 2008 at 7:51 PM, Dejan Bosanac <
dejan.bosanac@ttmsolutions.com> wrote:

> Hi,
>
> you already have Jetty, Spring and Ajax in the default ActiveMQ
> distribution and if all your Java consumer has to do is to save messages
> to the database, you could use Camel and iBatis
> (http://activemq.apache.org/camel/ibatis.html) or Hibernate
> (http://activemq.apache.org/camel/hibernate.html) components to save
> messages to the database.
>

Re: Question about implementing ActiveMQ

Posted by Dejan Bosanac <de...@ttmsolutions.com>.
Hi,

you already have Jetty, Spring and Ajax in the default ActiveMQ
distribution and if all your Java consumer has to do is to save messages
to the database, you could use Camel and iBatis
(http://activemq.apache.org/camel/ibatis.html) or Hibernate
(http://activemq.apache.org/camel/hibernate.html) components to save
messages to the database.

Cheers

-- 
Dejan Bosanac


http://www.ttmsolutions.com - get a free ActiveMQ user guide

ActiveMQ in Action - http://www.manning.com/snyder/
Scripting in Java - http://www.scriptinginjava.net



Juan Backson wrote:
> Hi,
>
> I am new to ActiveMQ and after reading through activeMQ's documentation, I
> realize that there are multiple ways of deploying ActiveMQ.
>
> In my system, I have a backend server which would fire off STOMP messages to
> ActiveMQ.  I have two ways to consume messages: one via java code and the
> other one via AJAX.  For the Java consumer, it would be best if I can have
> it hooked up somehow with ActiveMQ so I don't need to start a seperate
> process.   The Java code would store the messages into DB and AJAX would
> publish the messages to the web UI.
>
> Given this setting, what is the best way of deploying ActiveMQ?  Should I
> deploy activeMQ within Jetty using Spring and deploy my Java code as bean?
>
> Any suggestion will be greatly appreciated.
>
> Thanks in advance for all your help.
>
> JB
>
>