Class: Deimos::Configuration
- Inherits:
-
Object
- Object
- Deimos::Configuration
- Defined in:
- lib/deimos/configuration.rb
Overview
Class to hold configuration.
Instance Attribute Summary collapse
-
#disable_producers ⇒ Boolean
Disable all actual message producing.
-
#kafka_logger ⇒ Object
Returns the value of attribute kafka_logger.
- #logger ⇒ Logger
- #metrics ⇒ Metrics::Provider
-
#phobos_config_file ⇒ String
File path to the Phobos configuration file, relative to the application root.
-
#phobos_logger ⇒ Object
Returns the value of attribute phobos_logger.
-
#producer_schema_namespace ⇒ String
Default namespace for all producers.
-
#producer_topic_prefix ⇒ String
Add a prefix to all topic names.
-
#publish_backend ⇒ Symbol
Currently can be set to :db, :kafka, or :async_kafka.
- #report_lag ⇒ Boolean
-
#reraise_consumer_errors ⇒ Boolean
By default, consumer errors will be consumed and logged to the metrics provider.
-
#schema_path ⇒ String
Local path to schemas.
- #schema_registry_url ⇒ String
- #seed_broker ⇒ String
- #ssl_ca_cert ⇒ String
- #ssl_client_cert ⇒ String
- #ssl_client_cert_key ⇒ String
- #ssl_enabled ⇒ Boolean
- #tracer ⇒ Tracing::Provider
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
:nodoc:.
- #phobos_config_changed?(other_config) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
:nodoc:
76 77 78 79 |
# File 'lib/deimos/configuration.rb', line 76 def initialize @phobos_config_file = 'config/phobos.yml' @publish_backend = :kafka_async end |
Instance Attribute Details
#disable_producers ⇒ Boolean
Disable all actual message producing. Useful when doing things like mass imports or data space management when events don’t need to be fired.
42 43 44 |
# File 'lib/deimos/configuration.rb', line 42 def disable_producers @disable_producers end |
#kafka_logger ⇒ Object
Returns the value of attribute kafka_logger.
9 10 11 |
# File 'lib/deimos/configuration.rb', line 9 def kafka_logger @kafka_logger end |
#logger ⇒ Logger
7 8 9 |
# File 'lib/deimos/configuration.rb', line 7 def logger @logger end |
#metrics ⇒ Metrics::Provider
70 71 72 |
# File 'lib/deimos/configuration.rb', line 70 def metrics @metrics end |
#phobos_config_file ⇒ String
File path to the Phobos configuration file, relative to the application root.
46 47 48 |
# File 'lib/deimos/configuration.rb', line 46 def phobos_config_file @phobos_config_file end |
#phobos_logger ⇒ Object
Returns the value of attribute phobos_logger.
8 9 10 |
# File 'lib/deimos/configuration.rb', line 8 def phobos_logger @phobos_logger end |
#producer_schema_namespace ⇒ String
Default namespace for all producers. Can remain nil. Individual producers can override.
30 31 32 |
# File 'lib/deimos/configuration.rb', line 30 def producer_schema_namespace @producer_schema_namespace end |
#producer_topic_prefix ⇒ String
Add a prefix to all topic names. This can be useful if you’re using the same Kafka broker for different environments that are producing the same topics.
36 37 38 |
# File 'lib/deimos/configuration.rb', line 36 def producer_topic_prefix @producer_topic_prefix end |
#publish_backend ⇒ Symbol
Currently can be set to :db, :kafka, or :async_kafka. If using Kafka directly, set to async in your user-facing app, and sync in your consumers or delayed workers.
64 65 66 |
# File 'lib/deimos/configuration.rb', line 64 def publish_backend @publish_backend end |
#report_lag ⇒ Boolean
67 68 69 |
# File 'lib/deimos/configuration.rb', line 67 def report_lag @report_lag end |
#reraise_consumer_errors ⇒ Boolean
By default, consumer errors will be consumed and logged to the metrics provider. Set this to true to force the error to be raised.
15 16 17 |
# File 'lib/deimos/configuration.rb', line 15 def reraise_consumer_errors @reraise_consumer_errors end |
#schema_path ⇒ String
Local path to schemas.
25 26 27 |
# File 'lib/deimos/configuration.rb', line 25 def schema_path @schema_path end |
#schema_registry_url ⇒ String
18 19 20 |
# File 'lib/deimos/configuration.rb', line 18 def schema_registry_url @schema_registry_url end |
#seed_broker ⇒ String
21 22 23 |
# File 'lib/deimos/configuration.rb', line 21 def seed_broker @seed_broker end |
#ssl_ca_cert ⇒ String
52 53 54 |
# File 'lib/deimos/configuration.rb', line 52 def ssl_ca_cert @ssl_ca_cert end |
#ssl_client_cert ⇒ String
55 56 57 |
# File 'lib/deimos/configuration.rb', line 55 def ssl_client_cert @ssl_client_cert end |
#ssl_client_cert_key ⇒ String
58 59 60 |
# File 'lib/deimos/configuration.rb', line 58 def ssl_client_cert_key @ssl_client_cert_key end |
#ssl_enabled ⇒ Boolean
49 50 51 |
# File 'lib/deimos/configuration.rb', line 49 def ssl_enabled @ssl_enabled end |
#tracer ⇒ Tracing::Provider
73 74 75 |
# File 'lib/deimos/configuration.rb', line 73 def tracer @tracer end |
Instance Method Details
#phobos_config_changed?(other_config) ⇒ Boolean
83 84 85 86 87 88 |
# File 'lib/deimos/configuration.rb', line 83 def phobos_config_changed?(other_config) phobos_keys = %w(seed_broker phobos_config_file ssl_ca_cert ssl_client_cert ssl_client_cert_key) return true if phobos_keys.any? { |key| self.send(key) != other_config.send(key) } other_config.logger != self.logger end |