Class: AdvancedSneakersActiveJob::DelayedPublisher

Inherits:
BunnyPublisher::Base
  • Object
show all
Includes:
BunnyPublisher::Mandatory
Defined in:
lib/advanced_sneakers_activejob/delayed_publisher.rb

Overview

This publisher relies on TTL to keep messages in a queue. When TTL is reached, messages go to another exchange (see dlx_exchange_name param).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exchange:, **options) ⇒ DelayedPublisher

Returns a new instance of DelayedPublisher.



19
20
21
22
23
# File 'lib/advanced_sneakers_activejob/delayed_publisher.rb', line 19

def initialize(exchange:, **options)
  super(**options.merge(exchange: [exchange, 'delayed'].join('-'), exchange_options: { type: 'headers', durable: true }))

  @dlx_exchange_name = exchange
end

Instance Attribute Details

#dlx_exchange_nameObject (readonly)

Returns the value of attribute dlx_exchange_name.



17
18
19
# File 'lib/advanced_sneakers_activejob/delayed_publisher.rb', line 17

def dlx_exchange_name
  @dlx_exchange_name
end