Class: Hoodoo::Communicators::Fast

Inherits:
Object
  • Object
show all
Defined in:
lib/hoodoo/communicators/fast.rb

Overview

See Hoodoo::Communicators::Pool for details.

A “fast communicator”. Subclass this to create a class where instances are invoked via Hoodoo::Communicators::Fast#communicate with some parameter and, in response, they talk to some other piece of software to communicate information related to that parameter. The communication is expected to be fast and will be called from Ruby’s main execution thread.

If the communicator takes a long time to complete its operation, other processing will be delayed. If you expect this to happen, subclass Hoodoo::Communicators::Slow instead.

Example: A communicator might be part of a logging scheme which writes to STDOUT. The parameter it expects would be a log message string.

Direct Known Subclasses

Logger::FastCommunicator

Instance Method Summary collapse

Instance Method Details

#communicate(object) ⇒ Object

Communicate quickly with the piece of external software for which your subclass is designed. Subclasses must implement this method. There is no need to call super in your implementation.

object

Parameter sent by the communication pool, in response to someone calling Hoodoo::Communicators::Pool#communicate with that value.



39
40
41
# File 'lib/hoodoo/communicators/fast.rb', line 39

def communicate( object )
  raise( 'Subclasses must implement #communicate' )
end