JMS

分类

Point-to-Point

r

一个消息只有一个消è

Publish/Subscribe

r

一个消息有多个消è

API编程模型

Administration Object

Destination

r

消息提供è

Queue

Topic

ConnectionFactory

r

创建到Provider的è

QueueConnectionFactory

TopicConnectionFactory

Session

建立如下对象

Message Producer

Message Consumers

Message

Queue Browser

临时Queue和Topic

Connection

r

消息双发之é

Message

MessageBodies

r

TextMessage文本类型MapMessage String作为key, 基本类型作为value的消息StreamMessage流类型ObjectMessage可串è

MessageHeaders

r

以下是JMS的Header类型:JMSDestination send or publish methodJMSDeliveryMode send or publish methodJMSExpiration send or publish methodJMSPriority send or publish methodJMSMessageID send or publish methodJMSTimestamp send or publish methodJMSCorrelationID ClientJMSReplyTo ClientJMSType ClientJMSRedelivered JMS provider

MessageProperties

Message Producer

r

MessageProducer producer = session.createProducer(dest);producer.send(message);或è

Message Consumer

r

MessageConsumer consumer = session.createConsumer(dest);MessageConsumer consumer = session.createConsumer(queue);MessageConsumer consumer = session.createConsumer(topic);

同步

r

connection.start();Message m = consumer.receive();connection.start();Message m = consumer.receive(1000); // time out after a second

异步

r

Message ListenersListener myListener = new Listener();consumer.setMessageListener(myListener);Session会串è

Message Selector

r

建立Consumer的时候,可以指定Message Selector,è

Queue Browser

r

可以用来查看Queue中的内容QueueBrowser browser = session.createBrowser(queue);Topic没有对应的Browser

可靠的JMS

为什么用JMS

r

不è

对JMS的各参与者来说,如何实现可靠性

Producer

r

The most reliable way to produce a message is to send a PERSISTENT message within a transaction

Consumer

r

The most reliable way to consume a message is to do so within a transaction, either from a queue or from a durable subscription to a topic

Other Application

控制消息的过期

优先级

JMS提供的可靠性机制

基本的机制

管理消息应答

r

怎样才算是消息è

管理消息过期

消息持久化

建立临时Destination

高级的机制

JBOSS的实现

r

每一种组件é

Invocation Layer

Security Manager

Destination Manager

Status Manager

Message Cache

Persistence Manager

Destination Manager

Queue

Topic