activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: beginner needs help with topology
Date Tue, 08 Aug 2006 17:20:01 GMT
On 8/8/06, nkiesel <nkiesel@tbdnetworks.com> wrote:
> Hi all,
>
> this is my first attempt to use ActiveMQ, so please bear with me if I'm
> asking stupid questions.

Welcome! :)


>  I did try to find answers in the FAQ, the
> docu, and the forums, but I'm still undecided how/what to do.
>
> Requirements:
> I have two (identical) Java applications running on tho machines
> connected over the Internet.  These two applications act in a
> master/slave mode: every action done on the master must be repeated on
> the slave.  In case either the network or the slave is down, actions
> should be queued so that they can be processed once the slave is online
> again. On top of that, there is some transaction logic around these
> actions: a group of actions should be either executed completely or not
> at all by both the master and the slave. Finally, master and slave must
> be able to switch roles (by restarting master and slave with e.g. a
> command-line option).
>
> Implementation idea:
> I have a central place in the application where all actions pass
> through. Basic idea is now to splice in a durable queue or topic (see
> below) at this point that sends all actions over to the slave. The
> transaction logic will be implemented by adding "begin" and "end"
> actions. On startup, both apps look at their queue and either purge (if
> they find a "begin" without an "end") or process the queue before
> resuming execution.

I don't follow why you need a 'begin' and 'end' message? Is it to
process many messages in a single transaction? If so just have some
kinda marker on the last message (e.g. using Message Groups)

http://incubator.apache.org/activemq/message-groups.html

so that the JMSXGroupSeq = 0 for the last message

Then if JMSXGroupSeq is specified as a header you can call
session.commit() if the value is zero to atomically process all of the
messages.


> Questions:
> 1) Should I use embedded or standalone brokers?

It depends on your persistence strategy and how many JMS clients you
have. If you have lots of clients or want reliable persistence I'd
recommend a stand alone broker as its a bit easier to manage and
backup etc


> Also what is the
> recommended way to XML-configure an embedded broker?

http://incubator.apache.org/activemq/how-do-i-embed-a-broker-inside-a-connection.html


> 2) Should I use a topic or a composite destination?

Queues are generally easier to work with (you can browse then and load
balance them etc). So I'd recommend using 2 queues using either
Virtual Destinations or Composite Destinations. Though if you don't
need to load balance requests on the queue then durable topics is
fine.


> 3) Should I use brokers on both machines with a network connector for
> bridging them or have the slave app connect to the master broker?

I'd just run 1 broker - depending on your requirements maybe a
master/slave pair of brokers
http://incubator.apache.org/activemq/masterslave.html

> 4) Can I find out if there is an active sender/publisher for a
> queue/topic (so that the slave can decide on startup whether there is
> still a chance to get an "end" if he sees a "begin").

You can browse active consumers via JMX
http://incubator.apache.org/activemq/jmx.html

or receive advisories
http://incubator.apache.org/activemq/advisory-message.html


> While testing, I had some problems with the "two brokers" approach:
> after stopping/starting the slave broker, the slave app would no longer
> receive messages although both brokers successfully reconnected. This
> was even more the case with durable topics.  Is this a known issue?

Not sure - it could be.

-- 

James
-------
http://radio.weblogs.com/0112098/

Mime
View raw message