Class: NulogyMessageBusConsumer::Steps::ConnectToMessageBus
- Inherits:
-
Object
- Object
- NulogyMessageBusConsumer::Steps::ConnectToMessageBus
- Defined in:
- lib/nulogy_message_bus_consumer/steps/connect_to_message_bus.rb
Instance Method Summary collapse
- #call(**_) {|kafka_consumer: kafka_consumer| ... } ⇒ Object
-
#initialize(config, logger, kafka_consumer: nil) ⇒ ConnectToMessageBus
constructor
A new instance of ConnectToMessageBus.
Constructor Details
#initialize(config, logger, kafka_consumer: nil) ⇒ ConnectToMessageBus
Returns a new instance of ConnectToMessageBus.
4 5 6 7 8 |
# File 'lib/nulogy_message_bus_consumer/steps/connect_to_message_bus.rb', line 4 def initialize(config, logger, kafka_consumer: nil) @config = config @logger = logger @kafka_consumer = kafka_consumer end |
Instance Method Details
#call(**_) {|kafka_consumer: kafka_consumer| ... } ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nulogy_message_bus_consumer/steps/connect_to_message_bus.rb', line 10 def call(**_) @logger.info("Connecting to the MessageBus") @logger.info("Using consumer group id: #{@config.consumer_group_id}") subscribe trap("TERM") { kafka_consumer.close } wait_for_assignment yield(kafka_consumer: kafka_consumer) end |