Skip to content
Benjamin Diedrichsen edited this page Oct 7, 2015 · 4 revisions

To avoid confusion and increase precision of the available documentation, this page establishes a bit of a common vocabulary used throughout the documentation. Specifically, the terms "event" and "message" have their own definition within the context of the message bus system and as such require some clarification.

Message

A message is an object used for communication between multiple other objects. Other libraries established the term "event" which essentially refers to the same idea - an event occurs at some point in the system and is published to other components such that they might react to it.

MBassador uses the term message instead of event since the object sent through it does not necessarily represent an event. It might merely represent data to be processed, e.g. stored or transformed.

Message handler

A message handler is a method used to handle a certain type of message. It defines exactly one parameter (the message) and is annotated with @Handler. The handler's message type is defined by its method signature.

Message listener

An object that defines one or more message handlers and that has been subscribed at the message bus is referred to as (message) listener.

Subscription

Subscription is the process of adding a listener to the message bus, such that it might receive messages. It is used interchangeably with the term "registration".

Message publication|Message dispatch

The process of delivering a message from the sender to all registered listeners is called message publication. The initial phase of this process, that lasts until the message is actually delivered to the handlers is called message dispatch. The distinction is necessarily drawn as all method publications share a common scheme but may vary in the way how the dispatch is done.

Event

The term "event" refers to events that can occur during message publication. Currently there are two types of events:
  • DeadMessage: Whenever a message is published and no listeners exist that defined matching handlers, a DeadMessage event will be created and published using the common message publication mechanism. Listeners with handlers for DeadEvent can be subscribed to listen for and react to dead
  • FilteredMessage: Since handlers can define filters to narrow the set of messages it consumes, it is possible that a message is not delivered to any handler. In such a case the FilteredMessage event is published,
Clone this wiki locally