lib/queue_bus/publisher.rb in queue-bus-0.9.0 vs lib/queue_bus/publisher.rb in queue-bus-0.9.1
- old
+ new
@@ -1,14 +1,16 @@
+# frozen_string_literal: true
+
module QueueBus
- # publishes on a delay
+ # A simple publishing worker for QueueBus. Makes publishing asynchronously possible since
+ # it may be enqueued to the background worker with a delay. This will allow the event to
+ # be published at a later time.
class Publisher
-
class << self
def perform(attributes)
- event_type = attributes["bus_event_type"]
+ event_type = attributes['bus_event_type']
::QueueBus.log_worker("Publisher running: #{event_type} - #{attributes.inspect}")
::QueueBus.publish(event_type, attributes)
end
end
-
end
-end
\ No newline at end of file
+end