> <rant target="not at all chris personally">Oh good grief, if every time
> I want to do three or four quick tasks in parallel I have to drag out a
> workflow engine, I would go batty.</rant>
I'm confused by this. Can you please explain to me what is so bad with
using JMS to solve this?
Here's some pseudocode I would use to do it (shamelessly copied from Don
Fergusons/BEA session at their User Conference. Thanks Don!):
InitialContext ctx = new InitialContext(env);
Topic topic = (Topic) ctx.lookup("sometopic");
TopicConnectionFactory connectionFactory =
(TopicConnectionFactory)
ctx.lookup("javax.jms.TopicConnectionFactory");
TopicConnection connection =
connectionFactory.createTopicConnection();
TopicSession session = connection.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
TopicPublisher publisher = session.createPublisher(topic);
TextMessage message = session.createTextMessage();
message.setText(�hello world�);
publisher.publish(message);
publisher.close();
// Message sent; wait for response
TopicSubscriber subscriber = session.createSubscriber(topic);
connection.start();
Message m = subscriber.receive();
subscriber.close();
session.close();
connection.close();
-----
That wasn't so bad, was it? And you could easily abstract this away with
a helper class to:
----
Message m = jmsHelper.sendReceive("hello world", "sometopic"); // Send
"hello world" to "sometopic" and receive reply
----
Now, you've gotta explain to me what's so bad with the above, 'cause I
aint getting it.
Of course you could expand the above to send to several queues and
receive from several queues in order to do parallel processing.
What am I missing?
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.dreambean.com
Question reality
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".