Module: EventRouter::DeliveryAdapters::Helpers::Sidekiq

Extended by:
Helpers::Event
Defined in:
lib/event_router/delivery_adapters/helpers/sidekiq.rb

Class Method Summary collapse

Methods included from Helpers::Event

destination_options, event_options, yield_destinations

Class Method Details

.process_event(event, serialized_event: nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/event_router/delivery_adapters/helpers/sidekiq.rb', line 11

def process_event(event, serialized_event: nil)
  serialized_event ||= EventRouter.serialize(event)

  yield_destinations(event) do |destination, serialized_payload|
    options = destination_options(destination, EventRouter::DeliveryAdapters::Sidekiq)

    Workers::SidekiqDestinationDeliveryWorker
      .set(queue: options[:queue], retry: options[:retry])
      .perform_async(destination.name, serialized_event, serialized_payload)
  end
end