Sha256: 842fb7ada9352d19c668d8797a2a44a4c0eadd421636173c499af44e4e6cf9f2

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

module BunnyCarrot
  module Strategy
    class Base
      include BunnyCarrot::Logger

      def initialize(args)
        @queue_name       = args.fetch(:queue_name)
        @payload          = args.fetch(:payload)
        @headers          = args.fetch(:message_headers)
        @acknowledge_proc = args.fetch(:acknowledge_proc)
        post_initialize(args)
      end

      def perform
        raise NotImplementedError
      end

      protected

      def post_initialize(args)
      end

      private

      def acknowledge
        @acknowledge_proc.call
      end

      def publish
        RabbitHole.publish(payload:    @payload,
                           queue_name: @queue_name,
                           headers:    headers)
      end

      def headers
        @headers
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bunny_carrot-0.0.2 lib/bunny_carrot/strategy/base.rb