E N D
1. JMS AND MOM Dave Elliman
2. Messaging Messaging is a model in which applications are loosely coupled through the exchange of self-describing messages.
Message Oriented Middleware (MOM) encompasses publish/subscribe and message queuing communications.
3. Messages vs. RPC Why uses Messages?Messages provides loose coupling
Large scale systems: RPC often too tightly coupled
Asynchronous interaction possible
Sender up while receiver down (or disconnected) and vice-versa - robust
Messages are highly flexible and can enable load sharing
4. What is a message? Anything can be a message : string, object, XML, JSON
Arbitrary interaction patterns possible
1-1, n-n, with replies, with no replies
5. Messaging Models
6. Interaction Styles Two main mode of message consumption on the receiver:
Blocking (synchronous, pull mode) with MessageConsumer.receive()
Non-blocking (asynchronous, push mode) with: MessageListener.onMessage(..)
7. Typically used with point-to-point queues Active Reception (Pull)
8. Passive Reception (Push) Typically used with 1-n communication (Publish/Subscribe)
9. What is JMS? Java Message Service
An API that is part of the JEE standard (since Java 1.3)
Relevant classes and interface in javax.jms
Supported by all JEE application servers: JBoss, Glassfish, BEA WebLogic, IBM WebSphere
10. About JMS JMS provides a Message Oriented Middleware (MOM)
Clients communicate via queues and topics
Queues and topics can provide different degrees of guarantee, persistence, atomicity, blocking/non blocking
Queues and topics are managed by a central server
Server might be distributed / replicated for performance / reliability
11. Widely used MOMs JMS already described
RabbitMQ (written in Erlang)
MSMQ (Microsoft)
Amazon (SQS) Simple Queue Service
WebSphere MQ (IBM)
Cocoas NSOperationQueue
12. Typical JMS Architecture
13. Message Oriented MiddlewareGuaranteed Delivery
14. I had a Problem (Coursemarker for C++) I did not want to be tied into using Windows on the server side (ok to support Windows clients)
I did not want to be tied into Java either (even using Groovy)
My server is Linux and my software written in Python
Is there a MOM for me?
15. what do you need? There are really two parts to my problem - and this is the usual clase
A Producer task when a student submits
A Consumer task that does the assessment and feedback
16. Easy.. Use RabbitMQ and Celery celery handles the tasks
RabbitMQ handles the messaging
17. Celery http://ask.github.com/celery
I can even use JSON for the messages
Wonderfully easy to use:
18. The producer calls the task This now carries on immediately leaving my web application responsive
Why can this also help with scaling?
19. And the message Queue? I tested it using a database as the message queue which celery supports
This was done by inserting a single line:
celery,
in my settings.py file for django
Not the best solution long term as does not help with scaling
20. There is a really fast, effective, scalable , reliable, vender-neutral MOM solution available now