Module: Isimud
- Includes:
- ActiveSupport::Configurable
- Defined in:
- lib/isimud/event_observer.rb,
lib/isimud.rb,
lib/isimud/event.rb,
lib/isimud/client.rb,
lib/isimud/logging.rb,
lib/isimud/railtie.rb,
lib/isimud/version.rb,
lib/isimud/test_client.rb,
lib/isimud/bunny_client.rb,
lib/isimud/model_watcher.rb,
lib/isimud/event_listener.rb,
lib/rails/generators/isimud/config_generator.rb,
lib/rails/generators/isimud/initializer_generator.rb
Overview
Module for attaching and listening to events
Note: the following columns must be defined in your model:
:exchange_routing_keys text
Defined Under Namespace
Modules: EventObserver, Generators, Logging, ModelWatcher Classes: BunnyClient, Client, Event, EventListener, Railtie, TestClient
Constant Summary collapse
- VERSION =
'1.4.7'
Instance Attribute Summary collapse
-
#client_options ⇒ Hash
Client specific options.
-
#client_type ⇒ Enumerable<'bunny', 'test'>
Type of client to use.
-
#default_client ⇒ Isimud::Client
Default client.
-
#enable_model_watcher ⇒ Boolean
When set, send Isimud::ModelWatcher messages.
-
#events_exchange ⇒ String
AMQP exchange used for publishing Event instances.
-
#listener_error_limit ⇒ Integer
Maximum number of uncaught exceptions allowed per hour before listener shuts down (100).
-
#log_level ⇒ Symbol
Log level (:debug).
-
#logger ⇒ Logger
Logger for tracing messages (Rails.logger).
-
#model_watcher_exchange ⇒ String
AMQP exchange used for publishing ModelWatcher messages.
-
#model_watcher_schema ⇒ String
Schema name (Rails.configuration.database_configuration[‘database’]).
-
#prefetch_count ⇒ Integer
Number of messages to fetch – only applies to BunnyClient.
-
#retry_failures ⇒ Boolean|nil
When set to nil, the return status from exception handlers is used.
-
#server ⇒ <String, Hash>
Server connection attributes ().
Class Method Summary collapse
-
.client ⇒ Isimud::Client
Fetch or initialize the messaging client for this process.
- .client_class ⇒ Object
-
.connect ⇒ Object
Connect to the messaging server.
-
.model_watcher_enabled? ⇒ Boolean
Return status of model watching mode.
-
.reconnect ⇒ Object
Reconnect the messaging client.
Instance Attribute Details
#client_options ⇒ Hash
Returns client specific options.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#client_type ⇒ Enumerable<'bunny', 'test'>
Returns Type of client to use.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#default_client ⇒ Isimud::Client
Returns default client.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#enable_model_watcher ⇒ Boolean
Returns when set, send Isimud::ModelWatcher messages.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#events_exchange ⇒ String
Returns AMQP exchange used for publishing Event instances.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#listener_error_limit ⇒ Integer
Returns maximum number of uncaught exceptions allowed per hour before listener shuts down (100).
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#log_level ⇒ Symbol
Returns log level (:debug).
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#logger ⇒ Logger
Returns logger for tracing messages (Rails.logger).
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#model_watcher_exchange ⇒ String
Returns AMQP exchange used for publishing ModelWatcher messages.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#model_watcher_schema ⇒ String
Returns schema name (Rails.configuration.database_configuration[‘database’]).
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#prefetch_count ⇒ Integer
Returns number of messages to fetch – only applies to BunnyClient.
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#retry_failures ⇒ Boolean|nil
When set to nil, the return status from exception handlers is used. (false)
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
#server ⇒ <String, Hash>
Returns server connection attributes ().
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
Class Method Details
.client ⇒ Isimud::Client
Fetch or initialize the messaging client for this process.
70 71 72 |
# File 'lib/isimud.rb', line 70 def self.client self.default_client ||= client_class.new(server, || {}) end |
.client_class ⇒ Object
63 64 65 66 |
# File 'lib/isimud.rb', line 63 def self.client_class type = "#{client_type}_client".classify "Isimud::#{type}".constantize end |
.connect ⇒ Object
Connect to the messaging server
75 76 77 |
# File 'lib/isimud.rb', line 75 def self.connect client.connect end |
.model_watcher_enabled? ⇒ Boolean
Return status of model watching mode
80 81 82 |
# File 'lib/isimud.rb', line 80 def self.model_watcher_enabled? enable_model_watcher.nil? || enable_model_watcher end |
.reconnect ⇒ Object
Reconnect the messaging client
85 86 87 |
# File 'lib/isimud.rb', line 85 def self.reconnect client.reconnect end |