You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Paul French <pa...@frenchiesystems.com> on 2006/07/27 12:45:41 UTC

[NEWBIE] Toplogy Question (Confusion Reigns!!)

Morning all (well it is here),

I've been scanning the forums, reading blogs and articles for the last few
days and I think I know what I need to do. It would be great if someone
could confirm my thoughts or shoot me down in flames!!

I am in the process of wrapping ActiveMQ around my timetable request service
so that it can be used in a web environment.

Before I start it should be noted that the timetable request service has to
be started with a pre-configured number of threads. The reason for this is
that each thread has to create a large in memory structure so that the
algorithm runs as fast as possible.

I think this means I cannot use Lingo since I think Lingo is responsible for
starting a number of pre-configured threads where each thread consumes a
message and then calls the appropriate method on your service interface?

I am going to have a number of timetable request servers all running a
number of pre-configured threads where each thread pulls a timetable request
object from one queue running on another machine (the broker machine).

>From my understanding it appears all I need to do is have one JmsTemplate
shared among the timtetable request threads where each thread will have
their own session. I realise that I must use a
org.springframework.jms.connection.SingleConnectionFactory so that the same
JMS connection is used.

Each thread will simply call receive() and will block and wait for a message
to be received from the queue.

Out of interest if 4 threads call receive() at the same time and there is 4
timetable query objects on the queue will each thread get an object? (a
timetable request takes about 0.5seconds to process). Does ActiveMQ
automatically distribute messages in a round robin fashion when there is
multiple consumers listening on a single queue?

Now if we look at the web server that sends a timetable request object to
the queue, it seems that having one jmsTemplate shared amongst the web
server threads is sufficient where we reuse the same jms connection via the
SingleConnectionFactory. We simply call send.

Now since I do not require persistence or any transactional behaviour
ActiveMQ will send the messages async and so this should be quick and my web
server threads will not be blocked which is good!! I assume ActiveMQ will
send the messages in the background? What configuration options do I have
here like the concurrency of messages being sent in the background?

>From a web user point of view after the user has made a timetable request
using their browser I think the best thing to do is to display a wait page
that re-polls the web server every 2 seconds say. The web server will check
if the query has been answered and if so will display it. If not it will
re-display the wait page again. The users timetable query object will be
saved in their web session.

Now where I am struggling is working out how to do obtain the timetable
result. Do I also setup on each web server a temporary queue and have this
queue specified in the "JMS reply to" message header in the timetable
request object message?

When I send back the timetable result object to the web sever (i.e. the
temporary queue) do I setup a listener container e.g.
org.springframework.jms.listener.DefaultMessageListenerContainer that will
consume the messages in parallel from the temp queue and then update the
appropriate timetable query objects saved in the user sessions with the
given timetable results object?

I apologise for this being a mouthful but I've only started looking at
ActiveMQ and the new JMS support in Spring 2.0 in the last few days.

What has really slowed down my understanding of all the offerings out there
like Lingo, Spring JMS support, Jencks container and ActiveMQ is the lack of
clarity on all the different threads running and how it all fits together.

Any assistance would be gratefully recieved. Any pointers to any other
sources of information that I have missed would also be very beneficial.

Many thanks in advance!!

-- 
View this message in context: http://www.nabble.com/-NEWBIE--Toplogy-Question-%28Confusion-Reigns%21%21%29-tf2008876.html#a5518812
Sent from the ActiveMQ - User forum at Nabble.com.