Java Message Service - What and Why? Bill Kelly, Silvano Maffeis - - PowerPoint PPT Presentation

java message service what and why
SMART_READER_LITE
LIVE PREVIEW

Java Message Service - What and Why? Bill Kelly, Silvano Maffeis - - PowerPoint PPT Presentation

Java Message Service - What and Why? Bill Kelly, Silvano Maffeis SoftWired AG, Zrich info@softwired-inc.com www.JavaMessaging.com Agenda Make or Buy? Middleware Taxonomy, Messaging Java Message Service Overview Features of


slide-1
SLIDE 1

www.JavaMessaging.com

Java Message Service - What and Why?

Bill Kelly, Silvano Maffeis SoftWired AG, Zürich

info@softwired-inc.com

slide-2
SLIDE 2

www.JavaMessaging.com

Agenda

  • Make or Buy?
  • Middleware Taxonomy, Messaging
  • Java Message Service

– Overview – Features of note – Its place in J2EE, EJB – Products

  • For Further Information
slide-3
SLIDE 3

www.JavaMessaging.com

Middleware - Make or Buy?

  • Information systems are increasingly based on

distributed architectures.

  • Mobile and other new devices must be integrated:

Server, PC, Laptop, PDA, Cell Phone, ...

  • New transport protocols (e.g. wireless), different

qualities of service (best-effort, guaranteed, ...).

  • Systems become more complex, deadlines shorter.

“Write-it-yourself” less an option.

slide-4
SLIDE 4

www.JavaMessaging.com

Middleware Taxonomy

  • Client/Server

– a.k.a. RPC; procedure-oriented

  • Distributed Objects

– Object-oriented. CORBA, DCOM, RMI

  • Message Oriented Middleware (MOM, Messaging)

– “Connectionless”, “asynchronous” – Best known through message queuing

slide-5
SLIDE 5

www.JavaMessaging.com

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.

Sender Receiver MOM Messages

slide-6
SLIDE 6

www.JavaMessaging.com

Message Queuing

Producer Queue Consumer Consumer send(m1) send(m3) send(m2) receive() m1 m2 receive() Put message into queue Consume message

slide-7
SLIDE 7

www.JavaMessaging.com

Publish/Subscribe

Producer Broker Consumer Consumer publish(m1) send(m1) Pass message to broker send(m1) send(m2) send(m2) Dispatch message to all consumers publish(m2) publish(m3)

slide-8
SLIDE 8

www.JavaMessaging.com

Message Queuing Application

slide-9
SLIDE 9

www.JavaMessaging.com

Publish/Subscribe Application

subscribe (“AAPL”); subscribe (“AAPL”); subscribe (“SUN”); subscribe (“AAPL”); subscribe (“SUN”); publish (“AAPL”, 29.2); publish(“AAPL”, 29.3); publish (“SUN”, 43.0); publish(“SUN”, 42.7);

slide-10
SLIDE 10

www.JavaMessaging.com

JMS Overview

Goals of Java Message Service (JMS):

  • Standardized API for Messaging in Java
  • System-independent API for development of

heterogeneous, distributed applications

  • Use of arbitrary Java objects as messages
  • Natural fit with XML messages (Extensible Markup

Language) through data-centric model.

  • Dual API for the two models:

– Point to point (Message Queuing) – Publish-Subscribe

slide-11
SLIDE 11

www.JavaMessaging.com

JMS Functionality

  • Message Formats

– TextMessage, BytesMessage, MapMessage (Hashtable), StreamMessage, ObjectMessage

  • Quality of Service

– Persistent/non-persistent delivery – Priorities, time to live, transactions

  • Threaded programming model
  • Outside the spec:

– Security services – Management services

slide-12
SLIDE 12

www.JavaMessaging.com

JMS Publisher Example

Initialize JMS: session = connection.createTopicSession( transacted, ackMode); topic = session.createTopic(”quotes"); publisher = session.createPublisher(topic); Create a message: message = session.createTextMessage(…); Send a message: publisher.publish(message);

slide-13
SLIDE 13

www.JavaMessaging.com

JMS Subscriber Example

Initialize JMS: session = connection.createTopicSession(...); topic = session.createTopic(”quotes"); subscriber = session.createSubscriber(topic); Create a consumer: consumer = new MyConsumer(); subscriber.setMessageListener(consumer); Consumer receives messages via listener: void onMessage(Message message);

slide-14
SLIDE 14

www.JavaMessaging.com

JMS Pub-Sub Classes

slide-15
SLIDE 15

www.JavaMessaging.com

More JMS Features

  • Message selectors:

– SQL-like syntax for accessing header: subscriber = session.createSubscriber( topic, “priority > 6 AND type = ‘alert’ ”); – Point to point: selector determines single recipient – Pub-sub: acts as filter

  • Transactions

– void onMessage(Message m) { try { Message m2=processOrder(m); publisher.publish(m2); session.commit(); } catch(Exception e) { session.rollback(); }

slide-16
SLIDE 16

www.JavaMessaging.com

Request/Reply with Messages

  • “80% of inter-application communication is

asynchronous, 20% is synchronous (RPC)”

  • JMS also provides request/reply
  • Request message includes Topic/Queue to reply to
  • TopicRequestor/QueueRequestor helper classes
  • Idea can easily be extended, e.g. iBus has:

– Request with timeout – Request with multiple replies

  • Uses:

– Fault tolerance (N equivalent replyers).

slide-17
SLIDE 17

www.JavaMessaging.com

JMS and J2EE, EJB

  • Enterprise JavaBeans
  • JavaServer Pages
  • Servlets
  • Java Naming and

Directory Interface (JNDI)

  • Java Transaction API (JTA)
  • CORBA
  • JDBC data access
  • ... and JMS!

The J2EE Family:

RMI, CORBA, JMS RMI, CORBA, JMS

slide-18
SLIDE 18

www.JavaMessaging.com

JMS and Enterprise Java Beans

  • Application server provides EJB, freeing applications from

details of threading, transactions, scalability, fault-tolerance.

  • JMS plays similar role to CORBA and RMI: connection from

the outside wanting service. Full integration into EJB spec expected June 2000.

  • App server transactions replace/augment JMS transactions.
  • Messaging implementations from app-server vendors may

not be as scalable, flexible as from “pure messaging vendors”.

slide-19
SLIDE 19

www.JavaMessaging.com

JMS Products

  • Pure Java

– SoftWired iBus (http://www.JavaMessaging.com/ibus) – Progress SonicMQ (http://www.progress.com/sonicmq/) – FioranoMQ (http://www.fiorano.com)

  • Java API, C/C++ Implementation

– Sun’s JMQ Product

  • JMS API to existing MOM Products

– IBM MQSeries (http://www. ibm.com/mqseries)

  • Application Server Add-On

– BEA Systems WebLogic, Borland Application Server.

slide-20
SLIDE 20

www.JavaMessaging.com

Distinguishing Features of Products

  • Pure Java?
  • Pub-sub and point to point domains?
  • Performance?
  • Integration with other products, other languages?
  • Quality of service and transport protocols (HTTP)?
  • Security?
  • XML? (usually simplistic)
  • Management tools?
  • Pricing, professional services, and support?
slide-21
SLIDE 21

www.JavaMessaging.com

For Further Information

  • http://www.java.sun.com/products/jms
  • Developing Java Enterprise Applications

by Stephen Asbury and Scott R. Weiner. Wiley & Sons. has 80 pages on JMS, also addresses JNDI, EJB (OK overview book).

  • SoftWired JMS articles:

http://www.JavaMessaging.com