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/railtie.rb,
lib/isimud/version.rb,
lib/isimud/logging.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
- VERSION =
'1.4.0'
Instance Attribute Summary (collapse)
-
- (Hash) client_options
Client specific options.
-
- (Enumerable<'bunny', 'test'>) client_type
Type of client to use.
-
- (Isimud::Client) default_client
Default client.
-
- (Boolean) enable_model_watcher
When set, send Isimud::ModelWatcher messages.
-
- (String) events_exchange
AMQP exchange used for publishing Event instances.
-
- (Integer) listener_error_limit
Maximum number of exceptions allowed per hour before listener shuts down (100).
-
- (Symbol) log_level
Log level (:debug).
-
- (Logger) logger
Logger for tracing messages (Rails.logger).
-
- (String) model_watcher_exchange
AMQP exchange used for publishing ModelWatcher messages.
-
- (String) model_watcher_schema
Schema name (Rails.configuration.database_configuration['database']).
-
- (Integer) prefetch_count
Number of messages to fetch – only applies to BunnyClient.
-
- (Boolean|nil) retry_failures
When set to nil, the return status from exception handlers is used.
-
- (<String, Hash>) server
Server connection attributes ().
Class Method Summary (collapse)
-
+ (Isimud::Client) client
Fetch or initialize the messaging client for this process.
- + (Object) client_class
-
+ (Object) connect
Connect to the messaging server.
-
+ (Boolean) model_watcher_enabled?
Return status of model watching mode.
-
+ (Object) reconnect
Reconnect the messaging client.
Instance Attribute Details
- (Hash) client_options
Returns client specific options
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (Enumerable<'bunny', 'test'>) client_type
Returns Type of client to use
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (Isimud::Client) default_client
Returns default client
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (Boolean) enable_model_watcher
Returns when set, send Isimud::ModelWatcher messages
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (String) events_exchange
Returns AMQP exchange used for publishing Event instances
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (Integer) listener_error_limit
Returns maximum number of 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 |
- (Symbol) log_level
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 |
- (String) model_watcher_exchange
Returns AMQP exchange used for publishing ModelWatcher messages
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (String) model_watcher_schema
Returns schema name (Rails.configuration.database_configuration['database'])
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
- (Integer) prefetch_count
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 |
- (Boolean|nil) retry_failures
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 |
- (<String, Hash>) server
Returns server connection attributes ()
34 35 36 |
# File 'lib/isimud.rb', line 34 config_accessor :client_type do :bunny end |
Class Method Details
+ (Isimud::Client) 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 |
+ (Object) client_class
63 64 65 66 |
# File 'lib/isimud.rb', line 63 def self.client_class type = "#{client_type}_client".classify "Isimud::#{type}".constantize end |
+ (Object) connect
Connect to the messaging server
75 76 77 |
# File 'lib/isimud.rb', line 75 def self.connect client.connect end |
+ (Boolean) model_watcher_enabled?
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 |
+ (Object) reconnect
Reconnect the messaging client
85 86 87 |
# File 'lib/isimud.rb', line 85 def self.reconnect client.reconnect end |