Sha256: 546d5441ea9fe706a86010c80a83b21982500a2de3a6b198d30756fcb0bd2978

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

# !SLIDE :capture_code_output true
# One-way ZMQ service on alternate queue.

require 'example_helper'
require 'asir/transport/zmq'
begin
  zmq = ASIR::Transport::Zmq.new(:port => 31923,
                                 :encoder => ASIR::Coder::Marshal.new,
                                 :one_way => true,
                                 :queue => 'alternate')
  server_process do
    zmq.prepare_server!
    zmq.run_server!
  end
  UnsafeService.asir.transport = t = zmq
  pr(UnsafeService.asir._configure{ | message, proxy |
       message[:queue] = 'alternate'
     }.do_it(":ok"))
  pr(UnsafeService.asir._configure{ | message, proxy |
       message[:queue] = 'other'
     }.do_it(":other"))
rescue ::Exception => err
  $stderr.puts "### #{$$}: ERROR: #{err.inspect}\n  #{err.backtrace * "\n  "}"
  raise
ensure
  zmq.close rescue nil; sleep 1; server_kill
end

# !SLIDE END
# EXPECT: : client process
# EXPECT: : server process
# EXPECT: UnsafeService.do_it => :ok
# EXPECT: : pr: nil
# EXPECT!: UnsafeService.do_it => :other
# EXPECT!: ERROR

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asir_zmq-1.2.0 example/ex03.rb