Class: Dionysus::Consumer::Registry::Registration
- Inherits:
-
Object
- Object
- Dionysus::Consumer::Registry::Registration
- Defined in:
- lib/dionysus/consumer/registry.rb
Defined Under Namespace
Classes: Topic
Instance Attribute Summary collapse
-
#consumers ⇒ Object
readonly
Returns the value of attribute consumers.
-
#deserializer_klass ⇒ Object
readonly
Returns the value of attribute deserializer_klass.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#topics ⇒ Object
readonly
Returns the value of attribute topics.
Instance Method Summary collapse
- #deserializer(deserializer_klass) ⇒ Object
-
#initialize(namespace) ⇒ Registration
constructor
A new instance of Registration.
- #topic(name, options = {}, &block) ⇒ Object
Constructor Details
#initialize(namespace) ⇒ Registration
Returns a new instance of Registration.
24 25 26 27 28 29 |
# File 'lib/dionysus/consumer/registry.rb', line 24 def initialize(namespace) @namespace = namespace @topics = [] @deserializer_klass = nil @consumers = [] end |
Instance Attribute Details
#consumers ⇒ Object (readonly)
Returns the value of attribute consumers.
22 23 24 |
# File 'lib/dionysus/consumer/registry.rb', line 22 def consumers @consumers end |
#deserializer_klass ⇒ Object (readonly)
Returns the value of attribute deserializer_klass.
22 23 24 |
# File 'lib/dionysus/consumer/registry.rb', line 22 def deserializer_klass @deserializer_klass end |
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
22 23 24 |
# File 'lib/dionysus/consumer/registry.rb', line 22 def namespace @namespace end |
#topics ⇒ Object (readonly)
Returns the value of attribute topics.
22 23 24 |
# File 'lib/dionysus/consumer/registry.rb', line 22 def topics @topics end |
Instance Method Details
#deserializer(deserializer_klass) ⇒ Object
31 32 33 |
# File 'lib/dionysus/consumer/registry.rb', line 31 def deserializer(deserializer_klass) @deserializer_klass = deserializer_klass end |
#topic(name, options = {}, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/dionysus/consumer/registry.rb', line 35 def topic(name, = {}, &block) new_topic = Topic.new(namespace, name, deserializer_klass, , &block) consumer = Dionysus::Consumer::KarafkaConsumerGenerator.new.generate( Dionysus::Consumer.configuration, new_topic ) consumers << consumer new_topic.consumer = consumer topics << new_topic end |