Module: Banter
- Defined in:
- lib/banter/db_logger.rb,
lib/banter.rb,
lib/banter/cli.rb,
lib/banter/server.rb,
lib/banter/context.rb,
lib/banter/message.rb,
lib/banter/railtie.rb,
lib/banter/version.rb,
lib/banter/notifier.rb,
lib/banter/publisher.rb,
lib/banter/middleware.rb,
lib/banter/subscriber.rb,
lib/banter/configuration.rb,
lib/banter/rabbit_logger.rb,
lib/banter/delay_publish_model.rb,
lib/banter/server/subscriber_server.rb,
lib/banter/server/rabbit_mq_subscriber.rb,
lib/banter/server/client_queue_listener.rb,
lib/generators/banter/install_generator.rb,
lib/banter/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: Configuration, DelayPublishModel, Notifier, Server Classes: CLI, Context, DbLogger, InstallGenerator, Message, Middleware, PayloadValidationError, Publisher, RabbitLogger, Railtie, Subscriber
Constant Summary collapse
- VERSION =
"2.2.3"
Class Method Summary collapse
-
.configure {|Banter::Configuration| ... } ⇒ Object
A convenience methods, specially for non-rails applications to configure Banter Usage: Banter.configure do |config| config.default_queue_ttl = 2.hours end.
-
.delay_messages ⇒ Object
Delay actual publishing of messages to rabbitmq.
-
.logger ⇒ Logger
Logger used for logging through the Banter gem.
- .logger=(logger) ⇒ Object
-
.publish(routing_key, payload) ⇒ Object
This method publishes payload to rabbitmq.
Class Method Details
.configure {|Banter::Configuration| ... } ⇒ Object
A convenience methods, specially for non-rails applications to configure Banter Usage: Banter.configure do |config|
config.default_queue_ttl = 2.hours
end
62 63 64 |
# File 'lib/banter.rb', line 62 def self.configure yield Banter::Configuration end |
.delay_messages ⇒ Object
Delay actual publishing of messages to rabbitmq. Any messages published using Banter.publish will be delayed till after the block. if any errors happen in this block, then no messages are published to the rabbitmq. Usage: Banter.delay_messages do
Banter.publish('foo.bar', {}) # -> message will not be published here
end # -> message will be published here
41 42 43 |
# File 'lib/banter.rb', line 41 def self. Publisher.instance.{ yield } end |
.logger ⇒ Logger
Returns Logger used for logging through the Banter gem.
46 47 48 49 |
# File 'lib/banter.rb', line 46 def self.logger return Banter::Configuration.logger if Banter::Configuration.logger @logger ||= ActiveSupport::TaggedLogging.new(Logger.new($stdout)) end |
.logger=(logger) ⇒ Object
52 53 54 |
# File 'lib/banter.rb', line 52 def self.logger=(logger) Banter::Configuration.logger = ActiveSupport::TaggedLogging.new(logger) end |
.publish(routing_key, payload) ⇒ Object
This method publishes payload to rabbitmq. All listeners with appropriate routing keys will receive the payload.
31 32 33 |
# File 'lib/banter.rb', line 31 def self.publish(routing_key, payload) Publisher.instance.publish(Banter::Context.instance, routing_key, payload) end |