Sha256: 364e22d9de681eb89727744c810644bbf95679328aee1780f135b5cd30d52fac

Contents?: true

Size: 704 Bytes

Versions: 2

Compression:

Stored size: 704 Bytes

Contents

require 'dripdrop/node'
Thread.abort_on_exception = true

DripDrop::Node.new do
  route :xrep_server, :zmq_xrep, 'tcp://127.0.0.1:2200', :bind
  route :xreq_client, :zmq_xreq, xrep_server.address,    :connect
   
  xrep_server.on_receive do |message,response|
    puts "REP #{message.body}"
    response.send_message(message)
  end

  i = 0; k = 0
  EM::PeriodicTimer.new(1) do
    i += 1; k += 1
     
    xreq_client.send_message(:name => 'test', :body => "Test Payload i#{i}") do |message|
      puts "RECV I RESP #{message.inspect}"
    end
    xreq_client.send_message(:name => 'test', :body => "Test Payload k#{i}") do |message|
      puts "RECV K RESP #{message.inspect}"
    end
  end
end.start!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dripdrop-0.11.0-java example/xreq_xrep.rb
dripdrop-0.11.0 example/xreq_xrep.rb