Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How is JMS different from Reactive Streams?

I am learning about Reactive Streams in API and I am struck by the similarity between this and JMS. In JMS too we have asynchronous processing, publishers and subscribers. What perspective am I missing in making this equivalence?

like image 568
Shankar P S Avatar asked Mar 10 '23 16:03

Shankar P S


1 Answers

Reactive Streams is back pressure oriented, JMS is message oriented. Although you could do back pressure using JMS.

Blocking API (non-reactive)

java.util.concurrent.Future::get <-> javax.jms.MessageConsumer.receive

Non-blocking API

org.reactivestreams.Publisher::subscribe <-> javax.jms.MessageConsumer::setMessageListener org.reactivestreams.Subscriber::onNext <-> javax.jms.MessageListener::onMessage

Back pressure API <-> Message API

org.reactivestreams.Subscription::request <-> javax.jms.MessageProducer::send

Initialization / finalization / error-handling

org.reactivestreams.Subscriber::onSubscribe <-> javax.jms.MessageListener::onMessage org.reactivestreams.Subscriber::onError <-> javax.jms.MessageListener::onMessage org.reactivestreams.Subscriber::onComplete <-> javax.jms.MessageListener::onMessage org.reactivestreams.Subscription::cancel <-> javax.jms.MessageProducer::send

like image 154
Wat Avatar answered Mar 21 '23 17:03

Wat