On 1/26/07, saleem145 <[EMAIL PROTECTED]> wrote:

Hello,

I am trying to build a very simple finance application. I would like to use
a message bus to broadcast stock prices. The publisher would connect to an
exchange, get the prices and publish them onto the message bus. The
subscribers would connect to the message bus and read stock prices of it.

The publishers would work all the time, but the subscribers may or may not
be active. If they are not active, then I would just like the latest quote
to be cached and the older ones removed from the queue. Also the publishers
and subcribers would work asyncronously.

The messages would have the following format --

1. TimeStamp
2. Stock Ticker
3. Bid
4. Ask

On the subscription end, I would like to be able to have a command which
looks for a price of a particular stock ticker. For example, Fetch("IBM",
"Bid") and this should return the latest bid price.

For this part, enable last image caching on your price topics and use
retroactive consumers
http://activemq.apache.org/subscription-recovery-policy.html

then anyone subscribing to a price topic will immediately receive the
last price message. Then to implement your 'Fetch' just wrap up the
creation of a consumer, wait for the first message, then close the
consumer down again in a helper function


So the requirements are quite simple. Would ActiveMQ be suitable for such a
project.

Absolutely!


I need details on how does ActiveMQ works.

1. I presume ActiveMQ will be installed and run on a dedicated machine. My
publsher will need to connect to ActiveMQ and send it messages. Upon receipt
of messages ActiveMQ will store the messages in files since they need to be
persistent (I do not need queueing). Receivers will connect to ActiveMQ and
it will respond with appropriate answers. Is my understanding correct??

Yes


2. Is there a way in ActiveMQ, to specify if messages should be persistent
and how long they should persist.

This is a JMS question - you decide in the producer of a message
whether or not its persistent via JMS's setDeliveryMode on
MessageProducer

http://java.sun.com/j2ee/1.4/docs/api/javax/jms/MessageProducer.html#setDeliveryMode(int)

3. Can queueing be disabled.

Again a JMS question. Yes - just use a Topic rather than a Queue as
the destination


4. Is there a way to view and manage the different queues graphically??

Yes, see the Web Console or JConsole in the JDK
http://activemq.apache.org/web-console.html
http://activemq.apache.org/jmx.html
http://activemq.apache.org/tools.html


5. How will it locate the appropriate file fast -- will I need to create a
seperate queue for each equity??

ActiveMQ can deal with things for you - just create a new Topic for
each equity (if you want folks to be able to subscribe to that kind of
granularity).


6. If so, what if the names of all possible equities is not known in
advance?? Each time I have a new equity will I need to make changes, or will
it be able to handle it automatically.

ActiveMQ can handle you creating topics or queues dynamically at runtime.


7. Which is the best Open Source Message Bus for my needs??

ActiveMQ! :)

--

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

Reply via email to