Question

I'm working on a simple piece of functionality (actually a ruby gem, but that is beside the point) which can be used to

  • receive and persist incoming messages
  • send and persist outgoing messages
  • supplies a hook to the implementing code for performing some action based on a received message. Could for example send a reply, but also perform other actions.

I'm struggling to find a short and concise name for this functionality. Does this bare resemblance to any named patterns, and if so which?

***** UPDATE *****

To be more specific, what I am actually doing here is receiving and sending SMS.

Starting to wonder if perhaps the most appropriate name for this functionality would be an SMS dispatcher. From the Dispatcher page on wikipedia (although it has nothing to do with computing):

Dispatchers are communications personnel responsible for receiving and transmitting pure and reliable messages

Or would using the dispatcher name for this concept cause confusion with other design patterns?

Était-ce utile?

La solution

There are many patterns associated with messaging, as there are lots of facets to this problem. There is an entire section in the book Enterprise Integration Patterns, which is summarized here: http://www.eaipatterns.com/toc.html

The pattern to use depends on some parameters, such as: is this a point-to-point message? is there one sender and many receivers? vice versa? many-to-many? how is the recipient determined?

Here's some general patterns:

Point-to-Point

A sender establishes a direct connection to one destination. i.e., a call to a web service, remote procedure call

Publish-Subscribe

A single source of messages are published to all subscribers. Think RSS or Twitter.

Dispatcher

A dispatcher is used when there is a single source of messages and multiple destinations. All destinations receive each message and decide if they want to process it or not.

Router

Uses context to determine the destination of a message. The decision can be based on content of the message or external state or rules. Typically uses many sources of messages and routes to one of many destinations.

Broker

A broker is similar to a router in that it consumes messages from multiple sources and determines the correct destination. It differs, however, in that it may have logic for translating a message and/or negotiating with the sender to send different content.

Licencié sous: CC-BY-SA avec attribution
scroll top