Rubrik > Development >


    10.06.2008 16:16:47  Development    

Java Message Service (JMS) Message Driven Beans - process messages asynchronous

Java Message Service (JMS) - process messages asynchronous

Message Driven Beans

a message listener that consumes messages from a queue or a subscription

JMS is a inter-application technology, typically JMS will not be used if no other applications are involved.
Queue - Point - to - Point Messaging
Topic - publish/subscribe model
Reliable - a message will delivered once and only once
Types of Messages
  • TextMessage
  • BytesMessage
  • ObjectMessage
  • MapMessage
  • StreamMessage
  • The empty message
loosely coupled
messaging between applications and components
asynchronously; i.e., once the request is submitted, it is placed in a queue and the client disconnects from the server, then the queue service picks up the request from the specified queue, processes it, and puts the result message in another message queue
Asynchronous processing is used for the requests that take a longer time to process than a typical synchronous request
Hermes - a Java Swing application to browse a message queue.
Queue names should reflect the job they are doing
One MDB should only perform a single function
MDB act like a controller and delegate to handler classes
Delegate the work to a handler class. It's then easier to test and more portable.

JMS-Application steps to send or receive messages:
  1. JNDI lookups for the queue connection factory and Queue resources
  2. creating a JMS session
  3. sending or receiving a message
Messaginge Clients:
  • J2EE component
  • a application client
  • another enterprise bean
  • a Web component
  • application that does not use J2EE technology.

JMS Performance
Enterprise Architecture
Build a Workflow System with JMS