Sha256: f643e3763348179b9f8aeb62352ead196f16d149bc0599992cf8e84cfb899a5c

Contents?: true

Size: 589 Bytes

Versions: 2

Compression:

Stored size: 589 Bytes

Contents

# frozen_string_literal: true

module Jackhammer
  # The API to send messages to a topic with a given attribute
  class Publish
    class << self
      def topics
        @topics ||= {}
      end

      def publish(event, message, options)
        publish_options = Jackhammer.configuration.publish_options # system defaults
        publish_options[:routing_key] = event                   # routing_key
        publish_options = publish_options.merge options         # override any system defaults
        Jackhammer.connection.publish message, publish_options
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jackhammer-0.1.1 lib/jackhammer/publish.rb
jackhammer-0.1.0 lib/jackhammer/publish.rb