JMS会话的目的是什么? [英] What is the purpose of a JMS session?
问题描述
JMS会话的目的是什么?为什么单独的连接不足以在发件人和收件人之间交换JMS消息?
What is the purpose of a JMS session? Why isn't a connection alone sufficient to exchange JMS messages between senders and receivers?
推荐答案
Session对象是用于生成和使用消息的单线程上下文。虽然它可以在Java虚拟机(JVM)之外分配提供程序资源,但它被视为轻量级JMS对象。
A Session object is a single-threaded context for producing and consuming messages. Although it may allocate provider resources outside the Java virtual machine (JVM), it is considered a lightweight JMS object.
会话有多种用途:
- 它是消息生产者和消费者的工厂。
- 它提供提供商优化的消息工厂。
- 它支持一系列事务,这些事务将跨越生产者和消费者的工作组合成原子单元。
- 它定义了消费消息的序列顺序和消息它生成。
- 它会在确认之前保留它消耗的消息。
- 它序列化了向消息使用者注册的消息监听器的执行。
- It is a factory for its message producers and consumers.
- It supplies provider-optimized message factories.
- It supports a single series of transactions that combine work spanning its producers and consumers into atomic units.
- It defines a serial order for the messages it consumes and the messages it produces.
- It retains messages it consumes until they have been acknowledged.
- It serializes execution of message listeners registered with its message consumers.
会话可以创建和服务多个消息生产者和消费者。
A session can create and service multiple message producers and consumers.
一个典型的用法是在同步MessageConsumer上有一个线程块,直到消息到达。然后,该线程可以使用Session的MessageProducers中的一个或多个。
One typical use is to have a thread block on a synchronous MessageConsumer until a message arrives. The thread may then use one or more of the Session's MessageProducers.
这篇关于JMS会话的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!