官术网_书友最值得收藏!

Java Messaging Service API

Let's look at how Reactive Streams compares to the Java Messaging Service (JMS) API. The JMS specification describes a Queue and a Topic, to which a producer and a consumer can connect:

@Resource(lookup = "jms/Queue")
private static Queue queue;

@Resource(lookup = "jms/Topic")
private static Topic topic;
Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(queue);
MessageConsumer consumer = session.createConsumer(topic)

Here, the producer  is responsible for generating unbounded events on the queue or topics, while the consumer actively consumes the events. The producer and consumer are working in isolation, at their own rates. The task of managing the subscription is taken care of by the JMS broker. This is different from the Subscription API, where backpressure plays a major role in event generation. There is also no event modeling, like subscription, error, or completion. The JMS connection is like a never-ending stream of data. It cannot provide completion or error events. If we need to support this, custom objects must be modeled first.

主站蜘蛛池模板: 浠水县| 舞钢市| 淮南市| 登封市| 尚志市| 托克逊县| 迁安市| 海安县| 隆昌县| 庄河市| 东平县| 淅川县| 扎囊县| 马公市| 罗田县| 宿迁市| 扶绥县| 姚安县| 澳门| 老河口市| 嵊泗县| 林西县| 大厂| 洞头县| 资中县| 外汇| 镇巴县| 济宁市| 灵寿县| 罗城| 大冶市| 康平县| 香港 | 宁南县| 灵武市| 昆明市| 穆棱市| 突泉县| 武乡县| 民县| 温宿县|