Module: HonestPubsub

Defined in:
lib/honest_pubsub/logger.rb,
lib/honest_pubsub.rb,
lib/honest_pubsub/cli.rb,
lib/honest_pubsub/server.rb,
lib/honest_pubsub/context.rb,
lib/honest_pubsub/logging.rb,
lib/honest_pubsub/message.rb,
lib/honest_pubsub/railtie.rb,
lib/honest_pubsub/version.rb,
lib/honest_pubsub/db_logger.rb,
lib/honest_pubsub/publisher.rb,
lib/honest_pubsub/middleware.rb,
lib/honest_pubsub/subscriber.rb,
lib/honest_pubsub/configuration.rb,
lib/honest_pubsub/server/subscriber_server.rb,
lib/honest_pubsub/server/rabbit_mq_subscriber.rb,
lib/honest_pubsub/server/client_queue_listener.rb,
lib/honest_pubsub/exceptions/payload_validation_error.rb

Overview

In order to use the server, the caller must be able to bring in the necessary classes for require before instantiating the instance.

Defined Under Namespace

Modules: Logging, Server Classes: CLI, Configuration, Context, DbLogger, Logger, Message, Middleware, PayloadValidationError, Publisher, Railtie, Subscriber

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.loggerObject



39
40
41
# File 'lib/honest_pubsub.rb', line 39

def self.logger
  HonestPubsub::Logging.logger
end

.logger=(logger) ⇒ Object

Parameters:

  • logger (Logger)

    Logger used by HonestPubsub



44
45
46
# File 'lib/honest_pubsub.rb', line 44

def self.logger=(logger)
  HonestPubsub::Logging.logger = logger
end

.publish(routing_key, payload) ⇒ Object

This method publishes payload to rabbitmq. All listeners with appropriate routing keys will receive the payload.

Parameters:

  • routing_key (String)

    Identifier of the message type

  • payload (Hash)

    The data that will be passed to the subscriber



35
36
37
# File 'lib/honest_pubsub.rb', line 35

def self.publish(routing_key, payload)
  Publisher.instance.publish(HonestPubsub::Context.instance, routing_key, payload)
end

.rootObject



26
27
28
# File 'lib/honest_pubsub.rb', line 26

def self.root
  File.expand_path '../..', __FILE__
end