Publish-subscribe and Reactor patterns looking very similar to me. How they are different?

In both patterns a message is getting passed to subscribers indirectly (listeners in reactor pattern).

I feel observer pattern is very similar to two other patterns too.

What are key differences between those patterns?

3 Answers 3


As I can see from the link, PubSub pattern is not an OOP pattern, but rather messaging pattern, which is a network architectural pattern.

Reactor pattern is something related to servers' request handling with single-threaded event loop. Again, the link shows some good examples like Node.js, Netty, Twisted, etc.

Finally, Observer is OOP design-pattern which describes a way of interaction between objects in OO-code.

So those three patterns are from different domains.


Reactor = single threaded event loop that receives and processes requests. Those requests could be loaded in batches from a file, via SMTP and/or HTTP. Processed concurrently responses are delivered when ready rather than sequentially.

Publishers emit. Subscribers consume.

Publishers + Subscribers = Observer pattern (Heads First Design Patterns). Observers fire sequentially and usually block until they complete.


PubSub is more related to Messaging Queues (MQs). It has to do with how nodes receive asynchronous messages in a distributed system.

Reactor pattern has more to do with asynchronous events. For exemple, non-blocking sockets use the reactor pattern to deliver network events: READ, WRITE, CONNECT, ACCEPT

You can check CoralReactor to have a better understanding of the reactor pattern.

Disclaimer: I am one of the developers of CoralReactor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.