Sha256: f70a7ffa88c5a767941b52219e74e5d9de9ca7777a433e096b0a29556bfcaae4

Contents?: true

Size: 689 Bytes

Versions: 1

Compression:

Stored size: 689 Bytes

Contents

# coding: utf-8

################################################
# © Alexander Semyonov, 2013—2013              #
# Author: Alexander Semyonov <al@semyonov.us>  #
################################################

require 'synapses'
require 'synapses/contract/definitions'

module Synapses
  # @author Alexander Semyonov <al@semyonov.us>
  class Producer
    include Contract::Definitions

    def initialize(channel = nil)
      @channel = channel
    end

    def <<(message)
      EventMachine.next_tick do
        exchange.publish(message.to_payload, message.options) do
          puts "published [#{message.to_payload}, #{message.options}]"
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
synapses-0.0.1 lib/synapses/producer.rb