Publish ... subscribe ... observe ... event-bus?

Lately some colleagues and me were reasoning on how to do client-side (Browser, JavaScript) communication between web-page components … decoupled … in general I recommend taking a look at an event-bus (aka page-bus), with Java why not take a look at the refcodes-eventbus? … the following “equation” came to mind … simply speaking, the equation “Observer pattern” + “Publish–subscribe pattern” = “Message broker” solves to “refcodes-eventbus”

Lightweight message broker = event-bus?

A lightweight “Message broker” can be a good solution for requirements doing in-“JVM” (Java Virtual Machine) communication as of:

  • Signaling “events” to some “event-listener” …
  • Subscribing your “event-listener” for some specific “events” …
  • Publishing “events” merely to interested “event-listeners” …
  • Strongly decoupling the “publisher” and the “subscriber” …
  • Considering privacy issues (no simple broadcast) …

In the article refcodes-eventbus: Observer + Publish–subscribe = Message broker I describe the “refcodes-eventbus” accompanied with a plain simple example on how to use it.

The “refcodes-eventbus” artifact makes use of the “refcodes-matcher” framework for defining the “criteria” on when to deliver an “event” to an “event-listener”. It also sets on top of the “refcodes-observer” framework regarding issues around the “Observer pattern”

Beyond the realms of your JVM …

Combining the “refcodes-eventbus” with the “refcodes-remoting” “RPC” (remote procedure call) framework would extend the “refcodes-eventbus” beyond the borders of a single “JVM”. Regarding “RPC”, see also the article on refcodes-remoting: Face-to-face lightweight remote method calls!