Class: Proletariat::Publisher
- Inherits:
-
PoolableActor
- Object
- Concurrent::Actor::Utils::AbstractWorker
- PoolableActor
- Proletariat::Publisher
- Includes:
- Concerns::Logging
- Defined in:
- lib/proletariat/publisher.rb
Overview
Public: Receives messages and publishes them to a RabbitMQ topic exchange.
Instance Method Summary collapse
-
#cleanup ⇒ Object
Public: Closes the Bunny::Channel if open.
-
#work(message) ⇒ Object
Public: Push a Message to a RabbitMQ topic exchange.
Methods included from Concerns::Logging
Methods inherited from PoolableActor
Methods included from ActorCommon
Instance Method Details
#cleanup ⇒ Object
Public: Closes the Bunny::Channel if open.
Returns nil.
11 12 13 14 15 |
# File 'lib/proletariat/publisher.rb', line 11 def cleanup @channel.close if @channel nil end |
#work(message) ⇒ Object
Public: Push a Message to a RabbitMQ topic exchange.
message - A Message to send.
Returns nil.
22 23 24 25 26 27 28 |
# File 'lib/proletariat/publisher.rb', line 22 def work() if .is_a?(Message) exchange.publish(.body, routing_key: .to, persistent: !Proletariat.test_mode?, headers: .headers) end end |