Understanding the Java Message Service - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Understanding the Java Message Service

Description:

Describe the concepts and some practical applications of messaging. ... Deliver messages to JMS applications for processing. Understanding the Java Message Service ... – PowerPoint PPT presentation

Number of Views:74
Avg rating:3.0/5.0
Slides: 42
Provided by: orlan2
Category:

less

Transcript and Presenter's Notes

Title: Understanding the Java Message Service


1
Understanding the Java Message Service
Andreas Taber Systems Engineer Sonic Software
2
Overview
  • Describe the concepts and some practical
    applications of messaging.
  • Describe the concepts and basic structure of JMS.
  • Write simple JMS messaging code using the publish
    and subscribe and point-to-point domains.
  • Discuss advanced JMS issues such as guaranteed
    messaging, transactions, reliability, and
    recovery.

3
Part 1 Enterprise Messaging and JMS
4
Enterprise messaging
5
Tightly Coupled RPC
Requires n (n-1) / 2 connections
6
JMS messaging
  • Centralized message server (hub and spoke)

Decentralized message server (IP multicast)
7
The J2EE platform
J2EE Platform
8
JMS and Web Services
  • Program internet clients with standardized JMS
    and JAXM interface
  • Send SOAP, ebXML, and custom XML messages through
    the internet
  • Route internet messages to the enterprise message
    bus
  • Use XSLT to transform messages to standard
    formats
  • Deliver messages to JMS applications for
    processing

9
Part 2 JMS Concepts and Coding
10
Wholesaler and retailer
Update price (publish)
Message Server
Order product (send)
11
JMS features
  • Standard Java API
  • Message delivery modes
  • Two messaging models
  • Transactions
  • Reliability levels
  • Persistent messaging

12
JMS messaging domains
  • Publish and subscribe
  • Many consumers per message
  • Point-to-point
  • One consumer per message

13
Publish and subscribe Supply chain management
14
Point-to-point Order and fulfillment
Queue
Receiver
Need Supplies
Goods Shipped
15
JMS components
JMS Client
JMS Client
Connection
Connection
Session
Session
Producer
Consumer
Message Server
Message
Destination
Message
16
Connections and sessions
JMS Client
  • A connection connects to a message server.
  • You can create one or more sessions within a
    connection.

Connection
Session
Session
Session
17
Creating connections and sessions
JMS Client
ConnectionFactory
create
JNDI Store
Message Server
Connection
ConnectionFactories Destinations
Session
Session
Session
18
JMS message types
19
Creating a message
20
JMS message headers
  • Automatically assigned headers
  • JMSDestination
  • JMSDeliveryMode
  • JMSMessageID
  • JMSTimestamp
  • JMSExpiration
  • JMSRedelivered
  • JMSPriority
  • Developer-assigned headers
  • JMSReplyTo
  • JMSCorrelationID
  • JMSType

21
Producers, consumers, and destinations
Producer
Consumer
Bind to destination
Bind to destination
Read message
Message Server
Send message
Consume message
Destination
22
Creating destinations
JMS Client
JNDI Store
Message Server
Topic
ConnectionFactories Destinations
lookup
Queue
23
Producing a message
create message
Session
create
Message
Destination
MessageProducer
produce message
24
Consuming messages
Incoming messages
acknowledge
Message Server
Incoming messages
acknowledge
25
Asynchronous message delivery
MessageListener
onMessage(message)
Message Server
Incoming messages
acknowledge
26
Using receive( )
MessageConsumer
Message receive()
Message Server
Incoming messages
acknowledge
27
Filtering with message selector
Publisher
Departments.Sales
JMSPriority 2 Pipeline 20000
not delivered
Subscriber
delivered
Subscriber
Message Server
Departments.Sales Pipeline gt 20000
Departments.Sales Pipeline gt 15000
not delivered
delivered
Subscriber
Subscriber
Departments.Sales JMSPriority gt 5
Departments.Sales JMSPriority gt 2 AND Pipeline gt
10000
28
Browsing a queue
Message1
QueueBrowser
Message2
getEnumeration()
Message3
Enumeration
nextElement()
Message4
29
Accessing message content
Message
getlttypegt(Name)
TextMessage
MapMessage
ObjectMessage
StreamMessage
BytesMessage
getText()
getObject()
readlttypegt()
30
Part 3 Guaranteed messaging
31
Guaranteeing message delivery
Durable Subscriber Or QueueReceiver
PERSISTENT message
Message Server
Producer
Acknowledge message
Persistent store
Message removed after acknowledgment
32
Persistent and non-persistent messages
Non-persistent message not guaranteed to survive
provider failure
Message Server
Persistent message guaranteed to survive provider
failure
Persistent store
33
Acknowledgement modes
Consumer
Server
AUTO
CLIENT
DUPS_OK
34
Durable subscribers
Durable Subscriber1 (connected)
PERSISTENT message
Message Server
Publisher
Durable Subscriber2 (not connected)
Persistent store
Undelivered messages delivered to Subscriber2
when reconnected
35
Redelivered messages
  • Before message server receives acknowledgement
  • Message server has failed and restarted
  • OR
  • Consumer has failed and restarted

36
Part 4 Transactions and recovery
37
Transacted session Producer
Before commit( )
Message Server
Producer
Transacted session
Upon commit( )
Message Server
Consumer
38
Transacted session Consumer
Before commit( )
Message Server
Consumer
Deliver messages
Consume messages
Upon commit( )
Message Server
Consumer
Acknowledge messages
Delete messages if all recipients have
acknowledged
39
Distributed transaction support
JMS Client
XAConnectionFactory
create
JNDI Store
Message Server
XAConnection
ConnectionFactories Destinations
XASession
XASession
XASession
40
Recovering from a lost connection
41
Understanding the Java Message Service Conclusion
Write a Comment
User Comments (0)
About PowerShow.com