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

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.

主站蜘蛛池模板: 大化| 肥西县| 长治县| 黄浦区| 儋州市| 乐亭县| 南充市| 邹城市| 望奎县| 贵港市| 唐山市| 大渡口区| 绥江县| 多伦县| 阿拉善盟| 五河县| 开化县| 明水县| 贺兰县| 佛教| 乌审旗| 广平县| 琼海市| 时尚| 临夏县| 射阳县| 黄梅县| 广水市| 德格县| 雅安市| 邹城市| 黄平县| 理塘县| 延川县| 绍兴县| 肇州县| 大石桥市| 汕头市| 谢通门县| 布拖县| 甘孜县|