Class: Dionysus::Producer::Registry::Registration
- Inherits:
-
Object
- Object
- Dionysus::Producer::Registry::Registration
- Defined in:
- lib/dionysus/producer/registry.rb
Defined Under Namespace
Classes: Topic
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
-
#producers ⇒ Object
readonly
Returns the value of attribute producers.
-
#serializer_klass ⇒ Object
readonly
Returns the value of attribute serializer_klass.
-
#topics ⇒ Object
readonly
Returns the value of attribute topics.
Instance Method Summary collapse
-
#initialize(namespace) ⇒ Registration
constructor
A new instance of Registration.
- #serializer(serializer_klass) ⇒ Object
- #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/producer/registry.rb', line 24 def initialize(namespace) @namespace = namespace @topics = [] @serializer_klass = nil @producers = [] end |
Instance Attribute Details
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
22 23 24 |
# File 'lib/dionysus/producer/registry.rb', line 22 def namespace @namespace end |
#producers ⇒ Object (readonly)
Returns the value of attribute producers.
22 23 24 |
# File 'lib/dionysus/producer/registry.rb', line 22 def producers @producers end |
#serializer_klass ⇒ Object (readonly)
Returns the value of attribute serializer_klass.
22 23 24 |
# File 'lib/dionysus/producer/registry.rb', line 22 def serializer_klass @serializer_klass end |
#topics ⇒ Object (readonly)
Returns the value of attribute topics.
22 23 24 |
# File 'lib/dionysus/producer/registry.rb', line 22 def topics @topics end |
Instance Method Details
#serializer(serializer_klass) ⇒ Object
31 32 33 |
# File 'lib/dionysus/producer/registry.rb', line 31 def serializer(serializer_klass) @serializer_klass = serializer_klass end |
#topic(name, options = {}, &block) ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/dionysus/producer/registry.rb', line 35 def topic(name, = {}, &block) new_topic = Topic.new(namespace, name, serializer_klass, ) new_topic.instance_eval(&block) producer = Dionysus::Producer::KarafkaResponderGenerator.new.generate( Dionysus::Producer.configuration, new_topic ) producers << producer new_topic.producer = producer topics << new_topic end |