You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2017/01/10 15:59:01 UTC

[40/55] [partial] qpid-proton-j git commit: PROTON-1385: retain proton-j content only, the rest remains in the other repo at: https://git-wip-us.apache.org/repos/asf/qpid-proton.git

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/python/tx_recv_interactive.py
----------------------------------------------------------------------
diff --git a/examples/python/tx_recv_interactive.py b/examples/python/tx_recv_interactive.py
deleted file mode 100755
index c38f651..0000000
--- a/examples/python/tx_recv_interactive.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-from __future__ import print_function
-import sys
-import threading
-from proton.reactor import ApplicationEvent, Container, EventInjector
-from proton.handlers import MessagingHandler, TransactionHandler
-
-class TxRecv(MessagingHandler, TransactionHandler):
-    def __init__(self):
-        super(TxRecv, self).__init__(prefetch=0, auto_accept=False)
-
-    def on_start(self, event):
-        self.container = event.container
-        self.conn = self.container.connect("localhost:5672")
-        self.receiver = self.container.create_receiver(self.conn, "examples")
-        self.container.declare_transaction(self.conn, handler=self, settle_before_discharge=True)
-        self.transaction = None
-
-    def on_message(self, event):
-        print(event.message.body)
-        self.transaction.accept(event.delivery)
-
-    def on_transaction_declared(self, event):
-        self.transaction = event.transaction
-        print("transaction declared")
-
-    def on_transaction_committed(self, event):
-        print("transaction committed")
-        self.container.declare_transaction(self.conn, handler=self)
-
-    def on_transaction_aborted(self, event):
-        print("transaction aborted")
-        self.container.declare_transaction(self.conn, handler=self)
-
-    def on_commit(self, event):
-        self.transaction.commit()
-
-    def on_abort(self, event):
-        self.transaction.abort()
-
-    def on_fetch(self, event):
-        self.receiver.flow(1)
-
-    def on_quit(self, event):
-        c = self.receiver.connection
-        self.receiver.close()
-        c.close()
-
-try:
-    reactor = Container(TxRecv())
-    events = EventInjector()
-    reactor.selectable(events)
-    thread = threading.Thread(target=reactor.run)
-    thread.daemon=True
-    thread.start()
-
-    print("Enter 'fetch', 'commit' or 'abort'")
-    while True:
-        line = sys.stdin.readline()
-        if line:
-            events.trigger(ApplicationEvent(line.strip()))
-        else:
-            break
-except KeyboardInterrupt: pass
-
-

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/python/tx_send.py
----------------------------------------------------------------------
diff --git a/examples/python/tx_send.py b/examples/python/tx_send.py
deleted file mode 100755
index bda6780..0000000
--- a/examples/python/tx_send.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-from __future__ import print_function, unicode_literals
-import optparse
-from proton import Message, Url
-from proton.reactor import Container
-from proton.handlers import MessagingHandler, TransactionHandler
-
-class TxSend(MessagingHandler, TransactionHandler):
-    def __init__(self, url, messages, batch_size):
-        super(TxSend, self).__init__()
-        self.url = Url(url)
-        self.current_batch = 0
-        self.committed = 0
-        self.confirmed = 0
-        self.total = messages
-        self.batch_size = batch_size
-
-    def on_start(self, event):
-        self.container = event.container
-        self.conn = self.container.connect(self.url)
-        self.sender = self.container.create_sender(self.conn, self.url.path)
-        self.container.declare_transaction(self.conn, handler=self)
-        self.transaction = None
-
-    def on_transaction_declared(self, event):
-        self.transaction = event.transaction
-        self.send()
-
-    def on_sendable(self, event):
-        self.send()
-
-    def send(self):
-        while self.transaction and self.sender.credit and (self.committed + self.current_batch) < self.total:
-            seq = self.committed + self.current_batch + 1
-            msg = Message(id=seq, body={'sequence':seq})
-            self.transaction.send(self.sender, msg)
-            self.current_batch += 1
-            if self.current_batch == self.batch_size:
-                self.transaction.commit()
-                self.transaction = None
-
-    def on_accepted(self, event):
-        if event.sender == self.sender:
-            self.confirmed += 1
-
-    def on_transaction_committed(self, event):
-        self.committed += self.current_batch
-        if self.committed == self.total:
-            print("all messages committed")
-            event.connection.close()
-        else:
-            self.current_batch = 0
-            self.container.declare_transaction(self.conn, handler=self)
-
-    def on_disconnected(self, event):
-        self.current_batch = 0
-
-parser = optparse.OptionParser(usage="usage: %prog [options]",
-                               description="Send messages transactionally to the supplied address.")
-parser.add_option("-a", "--address", default="localhost:5672/examples",
-                  help="address to which messages are sent (default %default)")
-parser.add_option("-m", "--messages", type="int", default=100,
-                  help="number of messages to send (default %default)")
-parser.add_option("-b", "--batch-size", type="int", default=10,
-                  help="number of messages in each transaction (default %default)")
-opts, args = parser.parse_args()
-
-try:
-    Container(TxSend(opts.address, opts.messages, opts.batch_size)).run()
-except KeyboardInterrupt: pass

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/engine_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/engine_recv.rb b/examples/ruby/engine_recv.rb
deleted file mode 100644
index 1529964..0000000
--- a/examples/ruby/engine_recv.rb
+++ /dev/null
@@ -1,158 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require "qpid_examples"
-require "optparse"
-
-DEFAULT_PORT = 5672
-
-options = {
-  :port => DEFAULT_PORT,
-  :debug => false,
-  :verbose => false,
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: engine_recv.rb [options]"
-
-  opts.on("-p [port]", "--port [port]",
-          "The port to use  (def. #{DEFAULT_PORT})") do |port|
-    options[:port] = port
-  end
-
-  opts.on("-v", "--verbose",
-          "Enable verbose output") do
-    options[:verbose] = true
-  end
-
-  opts.on("-d",
-          "--debug", "Enable debugging") do
-    options[:debug] = true
-  end
-
-  opts.parse!
-end
-
-server = TCPServer.new('localhost', options[:port])
-
-last_time = Time.now
-
-message_count = 0
-driver = Driver.new
-
-collector = Qpid::Proton::Event::Collector.new
-
-loop do
-  begin
-    client = server.accept_nonblock
-  rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EINTR, Errno::EWOULDBLOCK => error
-
-  end
-
-  unless client.nil?
-    puts "Connection from #{client.peeraddr.last}"
-    connection = Qpid::Proton::Connection.new
-    connection.collect(collector)
-    transport = Qpid::Proton::Transport.new(Qpid::Proton::Transport::SERVER)
-    transport.bind(connection)
-    selectable = Selectable.new(transport, client)
-    driver.add(selectable)
-  end
-
-  # let the driver process data
-  driver.process
-
-  event = collector.peek
-
-  while !event.nil?
-    puts "EVENT: #{event}" if options[:debug]
-
-    case event.type
-    when Qpid::Proton::Event::CONNECTION_INIT
-      conn = event.connection
-      if conn.state & Qpid::Proton::Endpoint::REMOTE_UNINIT
-        conn.transport.sasl.done(Qpid::Proton::SASL::OK)
-      end
-
-    when Qpid::Proton::Event::CONNECTION_BOUND
-      conn = event.connection
-      if conn.state & Qpid::Proton::Endpoint::LOCAL_UNINIT
-        conn.open
-      end
-
-    when Qpid::Proton::Event::CONNECTION_REMOTE_CLOSE
-      conn = event.context
-      if !(conn.state & Qpid::Proton::Endpoint::LOCAL_CLOSED)
-        conn.close
-      end
-
-    when Qpid::Proton::Event::SESSION_REMOTE_OPEN
-      session = event.session
-      if session.state & Qpid::Proton::Endpoint::LOCAL_UNINIT
-        session.incoming_capacity = 1000000
-        session.open
-      end
-
-    when Qpid::Proton::Event::SESSION_REMOTE_CLOSE
-      session = event.session
-      if !(session.state & Qpid::Proton::Endpoint::LOCAL_CLOSED)
-        session.close
-      end
-
-    when Qpid::Proton::Event::LINK_REMOTE_OPEN
-      link = event.link
-      if link.state & Qpid::Proton::Endpoint::LOCAL_UNINIT
-        link.open
-        link.flow 400
-      end
-
-    when Qpid::Proton::Event::LINK_REMOTE_CLOSE
-      link = event.context
-      if !(link.state & Qpid::Proton::Endpoint::LOCAL_CLOSED)
-        link.close
-      end
-
-    when Qpid::Proton::Event::DELIVERY
-      link = event.link
-      delivery = event.delivery
-      if delivery.readable? && !delivery.partial?
-        # decode the message and display it
-        msg = Qpid::Proton::Util::Engine.receive_message(delivery)
-        message_count += 1
-        puts "Received:"
-        puts " Count=#{message_count}" if options[:verbose]
-        puts " From=#{msg.id}" if msg.id
-        puts " Reply to=#{msg.reply_to}" if msg.reply_to
-        puts " Subject=#{msg.subject}" if msg.subject
-        puts " Body=#{msg.body}" if msg.body
-        puts ""
-        delivery.settle
-        credit = link.credit
-        link.flow(200) if credit <= 200
-      end
-
-    when Qpid::Proton::Event::TRANSPORT
-      driver.process
-
-    end
-
-    collector.pop
-    event = collector.peek
-  end
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/engine_send.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/engine_send.rb b/examples/ruby/engine_send.rb
deleted file mode 100644
index 189c7fd..0000000
--- a/examples/ruby/engine_send.rb
+++ /dev/null
@@ -1,143 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_examples'
-require "optparse"
-
-DEFAULT_ADDRESS = "0.0.0.0:5672"
-
-options = {
-  :address => DEFAULT_ADDRESS,
-  :debug => false,
-  :verbose => false,
-  :count => 1,
-  :content => "This message was sent #{Time.new}"
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: engine_recv.rb [options]"
-
-  opts.on("-a [address]", "--address [address]",
-          "The target address (def. #{DEFAULT_ADDRESS})") do |address|
-    options[:address] = address
-  end
-
-  opts.on("-C [content]", "--content [content]",
-          "The message content") do |content|
-    options[:content] = content
-  end
-
-  opts.on("-c [count]", "--count [count]",
-          "The number of messages to send (def. 1)") do |count|
-    options[:count] = count.to_i
-  end
-
-  opts.on("-v", "--verbose",
-          "Enable verbose output") do
-    options[:verbose] = true
-  end
-
-  opts.on("-d",
-          "--debug", "Enable debugging") do
-    options[:debug] = true
-  end
-
-  opts.parse!
-end
-
-
-driver = Driver.new
-
-conn = Qpid::Proton::Connection.new
-collector = Qpid::Proton::Event::Collector.new
-conn.collect(collector)
-
-session = conn.session
-conn.open
-session.open
-
-sender = session.sender("tvc_15_1")
-sender.target.address = "queue"
-sender.open
-
-transport = Qpid::Proton::Transport.new
-transport.bind(conn)
-
-address, port = options[:address].split(":")
-
-socket = TCPSocket.new(address, port)
-selectable = Selectable.new(transport, socket)
-sent_count = 0
-
-sent_count = 0
-
-driver.add(selectable)
-
-loop do
-  # let the driver process
-  driver.process
-
-  event = collector.peek
-
-  unless event.nil?
-
-    print "EVENT: #{event}\n" if options[:debug]
-
-    case event.type
-
-    when Qpid::Proton::Event::LINK_FLOW
-      sender = event.sender
-      credit = sender.credit
-
-      message = Qpid::Proton::Message.new
-
-      if credit > 0 && sent_count < options[:count]
-        sent_count = sent_count.next
-        message.clear
-        message.address = options[:address]
-        message.subject = "Message #{sent_count}..."
-        message.body = options[:content]
-
-        delivery = sender.delivery("#{sent_count}")
-        sender.send(message.encode)
-        delivery.settle
-        sender.advance
-        credit = sender.credit
-      else
-        sender.close
-      end
-
-    when Qpid::Proton::Event::LINK_LOCAL_CLOSE
-      link = event.link
-      link.close
-      link.session.close
-
-    when Qpid::Proton::Event::SESSION_LOCAL_CLOSE
-      session = event.session
-      session.connection.close
-
-    when Qpid::Proton::Event::CONNECTION_LOCAL_CLOSE
-      break
-
-    end
-
-    collector.pop
-    event = collector.peek
-  end
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/example_test.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/example_test.rb b/examples/ruby/example_test.rb
deleted file mode 100755
index 9a01964..0000000
--- a/examples/ruby/example_test.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/enc ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require 'test/unit'
-require 'qpid_proton'
-require 'socket'
-
-$port = Random.new.rand(10000) + 10000
-
-class ExampleTest < Test::Unit::TestCase
-
-  def run_script(script, port)
-    assert File.exist? script
-    cmd = [RbConfig.ruby, script]
-    cmd += ["-a", ":#{port}/examples"] if port
-    return IO.popen(cmd)
-  end
-
-
-  def assert_output(script, want, port=nil)
-    out = run_script(script, port)
-    assert_equal want, out.read.strip
-  end
-
-  def test_helloworld
-    assert_output("reactor/helloworld.rb", "Hello world!", $port)
-  end
-
-  def test_send_recv
-    assert_output("reactor/simple_send.rb", "All 100 messages confirmed!", $port)
-    want = (0..99).reduce("") { |x,y| x << "Received: sequence #{y}\n" }
-    assert_output("reactor/simple_recv.rb", want.strip, $port)
-  end
-
-  def test_client_server
-    want =  <<EOS
--> Twas brillig, and the slithy toves
-<- TWAS BRILLIG, AND THE SLITHY TOVES
--> Did gire and gymble in the wabe.
-<- DID GIRE AND GYMBLE IN THE WABE.
--> All mimsy were the borogroves,
-<- ALL MIMSY WERE THE BOROGROVES,
--> And the mome raths outgrabe.
-<- AND THE MOME RATHS OUTGRABE.
-EOS
-    srv = run_script("reactor/server.rb", $port)
-    assert_output("reactor/client.rb", want.strip, $port)
-
-  ensure
-    Process.kill :TERM, srv.pid if srv
-  end
-end
-
-begin
-  broker = spawn("#{RbConfig.ruby} reactor/broker.rb -a :#{$port}")
-  # Wait for the broker to be listening.
-  while true
-    begin
-      s = TCPSocket.open "", $port
-      puts "Broker ready at #{$port}"
-      s.close
-      break
-    rescue Errno::ECONNREFUSED
-      puts "Retry connection to #{$port}"
-      sleep(0.1)
-    end
-  end
-
-  Test::Unit::AutoRunner.run
-
-ensure
-  Process.kill :TERM, broker if broker
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/lib/debugging.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/debugging.rb b/examples/ruby/lib/debugging.rb
deleted file mode 100644
index 5065d51..0000000
--- a/examples/ruby/lib/debugging.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-module Debugging
-
-  def debug(text)
-    print "[#{Time.now.strftime('%s')}] #{text}\n"
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/lib/driver.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/driver.rb b/examples/ruby/lib/driver.rb
deleted file mode 100644
index 4e223d0..0000000
--- a/examples/ruby/lib/driver.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-class Driver
-
-  def initialize
-    @selectables = {}
-  end
-
-  def add(selectable)
-    @selectables[selectable.fileno] = selectable
-  end
-
-  def process
-    reading = []
-    writing = []
-
-    @selectables.each_value do |sel|
-      if sel.closed? || sel.fileno.nil?
-        @selectables.delete(sel.fileno)
-      else
-        begin
-          reading << sel.to_io if sel.reading?
-          writing << sel.to_io if sel.writing?
-        rescue Exception => error
-          puts "Error: #{error}"
-          puts error.backtrace.join("\n");
-          # @selectables.delete(sel.fileno)
-        end
-      end
-    end
-
-    read_from, write_to = IO.select(reading, writing, [], 0)
-
-    unless read_from.nil?
-      read_from.each do |r|
-        sel = @selectables[r.fileno]
-        sel.readable unless sel.nil? || sel.closed?
-      end
-    end
-
-    begin
-      unless write_to.nil?
-        write_to.each do |w|
-          sel = @selectables[w.fileno]
-          sel.writable unless sel.nil? || sel.closed?
-        end
-      end
-
-    end
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/lib/qpid_examples.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/qpid_examples.rb b/examples/ruby/lib/qpid_examples.rb
deleted file mode 100644
index 8503fbe..0000000
--- a/examples/ruby/lib/qpid_examples.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require "qpid_proton"
-
-require "selectable"
-require "driver"
-require "socket"
-require "monitor"
-
-include Socket::Constants
-

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/lib/selectable.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/selectable.rb b/examples/ruby/lib/selectable.rb
deleted file mode 100644
index 779ea24..0000000
--- a/examples/ruby/lib/selectable.rb
+++ /dev/null
@@ -1,120 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-class Selectable
-
-  attr_reader :transport
-
-  def initialize(transport, socket)
-    @transport = transport
-    @socket = socket
-    @socket.autoclose = true
-    @write_done = false
-    @read_done = false
-  end
-
-  def closed?
-    return true if @socket.closed?
-    return false if !@read_done && !@write_done
-    @socket.close
-    true
-  end
-
-  def fileno
-    @socket.fileno unless @socket.closed?
-  end
-
-  def to_io
-    @socket
-  end
-
-  def reading?
-    return false if @read_done
-    c = @transport.capacity
-    if c > 0
-      return true
-    elsif c < 0
-      @read_done = true
-      return false
-    else
-      return false
-    end
-  end
-
-  def writing?
-    return false if @write_done
-    begin
-      p = @transport.pending
-      if p > 0
-        return true
-      elsif p < 0
-        @write_done = true
-        return false
-      else
-        return false
-      end
-    rescue Qpid::Proton::TransportError => error
-      @write_done = true
-      return false
-    end
-  end
-
-  def readable
-    c = @transport.capacity
-    if c > 0
-      begin
-        data = @socket.recv(c)
-        if data
-          @transport.push(data)
-        else
-          @transport.close_tail
-        end
-      rescue Exception => error
-        puts "read error; #{error}"
-        @transport.close_tail
-        @read_done = true
-      end
-    elsif c < 0
-      @read_done = true
-    end
-  end
-
-  def writable
-    begin
-      p = @transport.pending
-      if p > 0
-        data = @transport.peek(p)
-        n = @socket.send(data, 0)
-        @transport.pop(n)
-      elsif p < 0
-        @write_done = true
-      end
-    rescue Exception => error
-      puts "write error: #{error}"
-      puts error.backtrace.join("\n")
-      @transport.close_head
-      @write_done = true
-    end
-  end
-
-  def tick(now)
-    @transport.tick(now)
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/lib/send_and_receive.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/lib/send_and_receive.rb b/examples/ruby/lib/send_and_receive.rb
deleted file mode 100644
index 9fd7417..0000000
--- a/examples/ruby/lib/send_and_receive.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-class ExampleSend < Qpid::Proton::Handler::MessagingHandler
-
-  attr_reader :url
-
-  def initialize(url, expected)
-    super()
-    @url = url
-    @sent = 0
-    @confirmed = 0
-    @expected = expected
-  end
-
-  def on_sendable(event)
-    while event.sender.credit > 0 && @sent < @expected
-      msg = Qpid::Proton::Message.new
-      msg.body = "sequence #{@sent}"
-      msg.id = @sent
-      event.sender.send(msg)
-      @sent = @sent + 1
-    end
-  end
-
-  def on_accepted(event)
-    @confirmed = @confirmed + 1
-    if self.finished?
-      puts "#{@expected > 1 ? 'All ' : ''}#{@expected} message#{@expected > 1 ? 's' : ''} confirmed!"
-      event.connection.close
-    end
-  end
-
-  def on_disconnected(event)
-    @sent = @confirmed
-  end
-
-  def finished?
-    @confirmed == @expected
-  end
-
-end
-
-class ExampleReceive < Qpid::Proton::Handler::MessagingHandler
-
-  attr_reader :url
-
-  def initialize(url, expected)
-    super()
-    @url = url
-    @expected = expected
-    @received = 0
-  end
-
-  def on_message(event)
-    if event.message.id.nil? || event.message.id < @received
-      puts "Missing or old message id: id=#{event.message.id}"
-      return
-    end
-    if @expected.zero? || (@received < @expected)
-      puts "Received: #{event.message.body}"
-      @received = @received + 1
-      if finished?
-        event.receiver.close
-        event.connection.close
-      end
-    end
-  end
-
-  def finished?
-    @received == @expected
-  end
-
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/messenger/README.md
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/README.md b/examples/ruby/messenger/README.md
deleted file mode 100644
index 7cc8dee..0000000
--- a/examples/ruby/messenger/README.md
+++ /dev/null
@@ -1,163 +0,0 @@
-## Simple Messenger Examples
-
-The Messenger APIs, contained in the Qpid::Proton::Messenger class, represent the simplest means for sending and receive messages. An application need only create an instance of Messenger to have an endpoint for sending and receiving messages.
-
-Example applications, currently located in the messenger subdirectory, include:
-
-* **send.rb** - Sends one or more messages to a specific address.
-* **recv.rb** - Listens for messages sent to one or more addresses.
-
-### Sending A Simple Message Directly (Without A Broker)
-
-The goal of this example is to demonstrate how to send and receive messages directly between applications. To do that we've broken out the examples into two applciations: **send.rb** and **recv.rb**.
-
-First we need to start the receiver who will listen for an incoming connection:
-
-```
- $ ruby recv.rb ~0.0.0.0:8888
-```
-
-**NOTE:** Be sure to include the **tilda (~)** at the beginning of each address to be used. This tells the Messenger that it's going to be listening for connections on that port. And be sure to pick a free port for each of the addresses used.
-
-Now you can send messages with:
-
-```
- $ ruby send.rb -a 0.0.0.0:8888 "Hello world"
-```
-
-**NOTE:** Here you *don't* use a **tilda (~)** at the beginning of the address since you're specifying the receiver address rather than the address on which to listen.
-
-On the receiver side you should see something like:
-
-```
-Address: 0.0.0.0:8888
-Subject: How are you?
-Body: This is a test.
-Properties: {"sent"=>1432651492, "hostname"=>"mcpierce-laptop"}
-Instructions: {"fold"=>"yes", "spindle"=>"no", "mutilate"=>"no"}
-Annotations: {"version"=>1.0, "pill"=>"RED"}
-
-```
-
-This tells us the message we received as expected.
-
-### Sending A Simple Message Through A Broker
-
-To send a message via an intermediary, such as the Qpid broker, we need to give both the sender and the receiver a little bit more information, such as the hostname and port for the broker and the name of the queue where messages will be sent and received.
-
-If you're using the Qpid broker, this can be done using the **qpid-config**
-tool. Simply start your broker and then create our queue, which we'll call "examples":
-
-```
- $ qpid-config add queue examples
-```
-
-As of this point you can begin sending messages *without* starting the receiver. This is the benefit of using a broker, the ability to have something store messages for retrieval.
-
-Now let's send a bunch of messages to the queue using **send.rb**:
-
-```
- $ for which in $(seq 1 10); do ruby send.rb --address amqp://localhost/examples "This is test ${which}."; done
-```
-
-This example sends 10 messages to the our queue on the broker, where they will stay until retrieved.
-
-With this scenario we needed to specify the hostname of the broker and also the name of the queue in the address. After the sending completes you can verify the content of the queue using the **qpid-stat** command:
-
-```
-$ qpid-stat -q
-Queues
-  queue                                     dur  autoDel  excl  msg   msgIn  msgOut  bytes  bytesIn  bytesOut  cons  bind
-  =========================================================================================================================
-  examples                                                        10    10      0    2.65k  2.65k       0         0     1
-  fa4b8acb-03b6-4cff-9277-eeb2efe3c88a:0.0       Y        Y        0     0      0       0      0        0         1     2
-```
-
-Now to retrieve the messages. Start the **recv.rb** example using:
-
-```
-$ ruby recv.rb "amqp://127.0.0.1:5672/examples"
-```
-
-Once it connects to the broker, it will subscribe to the queue and begin receiving messages. You should see something like the following:
-
-```
-Address: amqp://localhost/examples
-Subject: How are you?
-Body: This is test 1.
-Properties: {"sent"=>1432837902, "hostname"=>"mcpierce-laptop"}
-Instructions: {"fold"=>"yes", "spindle"=>"no", "mutilate"=>"no"}
-Annotations: {"version"=>1.0, "pill"=>"RED"}
-Address: amqp://localhost/examples
-Subject: How are you?
-Body: This is test 2.
-Properties: {"sent"=>1432837903, "hostname"=>"mcpierce-laptop"}
-Instructions: {"fold"=>"yes", "spindle"=>"no", "mutilate"=>"no"}
-Annotations: {"version"=>1.0, "pill"=>"RED"}
-Address: amqp://localhost/examples
-Subject: How are you?
-Body: This is test 3.
-... truncating the remainder of the output ...
-```
-
-As with the sending, we specific the protocol to use and the address and port on the host to connect to the broker.
-
-##  Non-Blocking Receive With The Messenger APIs
-
-One of the downsides of Messenger is that, out of the box, it's a blocking set of APIs; i.e., when attempting to receive messages the Ruby VM is halted until the call returns.
-
-Enter **non-blocking mode**!
-
-When working in non-blocking mode you set a flag on your messenger to put it into non-blocking mode.
-
-```
-messenger = Qpid::Proton::Messenger.new
-messenger.passive = true
-```
-
-At this point the application is responsible for monitoring the set of file descriptors associated with those Messengers. It takes a little more code but the benefit is that the application can spawn this in a separate thread and not have the entire VM block during I/O operations. The **nonblocking_recv.rb** example app demonstrates how to perform this properly, how to wrap the file descriptor in a Selectable type, monitor it for when there's data to send or receive and then work with the instance of Messenger.
-
-For more details on how to do this, take a look at the comments in the example application.
-
-
-### Running The Non-Blocking Receiver
-
-To start the non-blocking receiver, simply start the example application like this:
-
-```
- $ ruby nonblocking_recv.rb ~0.0.0.0:8888
- This is a side thread:
-The time is now 11:39:24.
-The time is now 11:39:25.
-The time is now 11:39:26.
-```
-
-As the receiver runs it outputs the current time every second to show that a separate thread is running.
-
-Now you can launch the **client.rb** example to send a message to the receiver and then wait for a reply:
-
-```
- $ ruby client.rb -r "~/#" 0.0.0.0:8888 "This is a test." "Here is my message."
- amqp://c19f3e88-866a-46ae-8284-d229acf8a5cb/#, RE: This is a test.
-```
-
-As you see, in the command line we specify "~/#" as the address to which any reply should be sent. It's outside of the scope of this example, but the tilda (~) is expanded into a unique address by Proton and used for receiving any responses.
-
-On the receiver side you should see something like this:
-
-```
-The time is now 11:42:04.
-The time is now 11:42:05.
-The time is now 11:42:06.
-Address: 0.0.0.0:8888
-Subject: This is a test.
-Body:
-Properties: {}
-Instructions: {}
-Annotations: {}
-=== Sending a reply to amqp://c19f3e88-866a-46ae-8284-d229acf8a5cb/#
-The time is now 11:42:07.
-The time is now 11:42:08.
-```
-
-Notice in the receiver's output how the reply was sent to the address on the sender that was created by our specifying "~/#"

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/messenger/client.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/client.rb b/examples/ruby/messenger/client.rb
deleted file mode 100644
index a2c2564..0000000
--- a/examples/ruby/messenger/client.rb
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require 'qpid_proton'
-require 'optparse'
-
-
-$options  = {
-  :verbose => false,
-  :hostname => "0.0.0.0",
-  :subject => "",
-  :replyto => "~/replies"
-}
-
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: client [options] <addr> <subject>"
-
-  opts.on("-r", "--reply-to", String, :REQUIRED,
-          "Reply address") do |replyto|
-    $options[:replyto] = replyto
-  end
-
-  opts.on("-v", "--verbose", :NONE,
-          "Enable verbose output") do
-    $options[:verbose] = true
-  end
-
-  opts.on("-h", "--help", :NONE,
-          "Show this help message") do
-    puts opts
-    exit
-  end
-
-  begin
-    ARGV << "-h" if ARGV.empty?
-    opts.parse!(ARGV)
-  rescue OptionParser::ParseError => error
-    STDERR.puts error.message, "\n", opts
-    exit 1
-  end
-
-  ($options[:address], $options[:subject]) = ARGV
-
-  abort "No address specified" if $options[:hostname].nil?
-  abort "No subject specified" if $options[:subject].nil?
-
-end
-
-def log(text)
-  printf "#{Time.new}: #{text}\n" if $options[:verbose]
-end
-
-msgr = Qpid::Proton::Messenger::Messenger.new
-msgr.start
-
-msg = Qpid::Proton::Message.new
-msg.address = $options[:address]
-msg.subject = $options[:subject]
-msg.reply_to = $options[:replyto]
-
-msgr.put(msg)
-msgr.send
-
-if $options[:replyto].start_with? "~/"
-  msgr.receive(1)
-  begin
-    msgr.get(msg)
-    puts "#{msg.address}, #{msg.subject}"
-  rescue error
-    puts error
-  end
-end
-
-msgr.stop

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/messenger/mailserver.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/mailserver.rb b/examples/ruby/messenger/mailserver.rb
deleted file mode 100644
index 594a0e3..0000000
--- a/examples/ruby/messenger/mailserver.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-require 'qpid_proton'
-require 'optparse'
-
-FAILED         = 0
-CONNECTION_UP  = 1
-AUTHENTICATING = 2
-
-$options  = {
-  :verbose => false,
-  :address => ["amqp://~0.0.0.0"],
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: mailserver [options] <addr_1> ... <addr_n>"
-
-  opts.on("-v", "--verbose", :NONE,
-          "Print status messages to stdout") do |f|
-    $options[:verbose] = true
-  end
-
-  opts.parse!
-
-  if ARGV.length > 0
-    $options[:address] = []
-    ARGV.each {|address| $options[:address] << address}
-  end
-end
-
-def log(text)
-  STDOUT.puts "#{Time.new}: #{text}" if $options[:verbose]
-end
-
-msgr = Qpid::Proton::Messenger::Messenger.new
-msgr.start
-
-$options[:address].each {|addr| msgr.subscribe(addr)}
-
-def dispatch(request, response)
-  response.subject = "Re: #{request.subject}" if !request.subject.empty?
-  response.properties = request.properties
-  puts "Dispatched #{request.subject} #{request.properties}"
-end
-
-msg = Qpid::Proton::Message.new
-reply = Qpid::Proton::Message.new
-
-loop do
-  msgr.receive(10) if msgr.incoming < 10
-
-  if msgr.incoming > 0
-    msgr.get(msg)
-    if !msg.reply_to.nil? && !msg.reply_to.empty?
-      puts msg.reply_to
-      reply.address = msg.reply_to
-      reply.correlation_id = msg.correlation_id
-      reply.body = msg.body
-    end
-    dispatch(msg, reply)
-    msgr.put(reply)
-    msgr.send
-  end
-end
-
-msgr.stop

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/messenger/nonblocking_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/nonblocking_recv.rb b/examples/ruby/messenger/nonblocking_recv.rb
deleted file mode 100644
index 09dc3f9..0000000
--- a/examples/ruby/messenger/nonblocking_recv.rb
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'qpid_proton'
-require 'optparse'
-
-Thread.new do
-  print "This is a side thread:\n"
-  loop do
-    print "The time is now #{Time.new.strftime('%I:%M:%S')}.\n"
-    sleep 1
-  end
-end
-
-addresses = []
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: recv.rb <addr1> ... <addrn>"
-  opts.parse!
-
-  addresses = ARGV
-end
-
-addresses = ["~0.0.0.0"] if addresses.empty?
-
-messenger = Qpid::Proton::Messenger::Messenger.new
-messenger.passive = true
-
-begin
-  messenger.start
-rescue ProtonError => error
-  print "ERROR: #{error.message}\n"
-  print error.backtrace.join("\n")
-  exit
-end
-
-addresses.each do |address|
-  begin
-    messenger.subscribe(address)
-  rescue Qpid::Proton::ProtonError => error
-    print "ERROR: #{error.message}\n"
-    exit
-  end
-end
-
-msg = Qpid::Proton::Message.new
-
-read_array = []
-write_array = []
-selectables = {}
-
-loop do
-
-  # wait for incoming messages
-  sel = messenger.selectable
-  while !sel.nil?
-    if sel.terminal?
-      selectables.delete(sel.fileno)
-      read_array.delete(sel)
-      write_array.delete(sel)
-      sel.free
-    else
-      if !sel.registered?
-        read_array << sel
-        write_array << sel
-        selectables[sel.fileno] = sel
-        sel.registered = true
-      end
-    end
-    sel = messenger.selectable
-  end
-
-  unless selectables.empty?
-    rarray = []; read_array.each {|fd| rarray << fd.to_io }
-    warray = []; write_array.each {|fd| warray << fd.to_io }
-
-    if messenger.deadline > 0.0
-      result = IO.select(rarray, warray, nil, messenger.deadline)
-    else
-      result = IO.select(rarray, warray)
-    end
-
-    unless result.nil? && result.empty?
-      result.flatten.each do |io|
-        sel = selectables[io.fileno]
-
-        sel.writable
-        sel.readable
-      end
-    end
-
-    begin
-      messenger.receive(10)
-    rescue Qpid::Proton::ProtonError => error
-      print "ERROR: #{error.message}\n"
-      exit
-    end
-
-    while messenger.incoming.nonzero?
-      begin
-        messenger.get(msg)
-      rescue Qpid::Proton::Error => error
-        print "ERROR: #{error.message}\n"
-        exit
-      end
-
-      print "Address: #{msg.address}\n"
-      subject = msg.subject || "(no subject)"
-      print "Subject: #{subject}\n"
-      print "Body: #{msg.body}\n"
-      print "Properties: #{msg.properties}\n"
-      print "Instructions: #{msg.instructions}\n"
-      print "Annotations: #{msg.annotations}\n"
-
-      if msg.reply_to
-        print "=== Sending a reply to #{msg.reply_to}\n"
-        reply = Qpid::Proton::Message.new
-        reply.address = msg.reply_to
-        reply.subject = "RE: #{msg.subject}"
-        reply.body = "Thanks for the message!"
-
-        messenger.put(reply)
-        messenger.send
-      end
-    end
-  end
-end
-
-messenger.stop

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/messenger/recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/recv.rb b/examples/ruby/messenger/recv.rb
deleted file mode 100644
index 960de4d..0000000
--- a/examples/ruby/messenger/recv.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'qpid_proton'
-require 'optparse'
-
-addresses = []
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: recv.rb <addr1> ... <addrn>"
-  opts.parse!
-
-  addresses = ARGV
-end
-
-addresses = ["~0.0.0.0"] if addresses.empty?
-
-messenger = Qpid::Proton::Messenger::Messenger.new
-
-begin
-  messenger.start
-rescue ProtonError => error
-  puts "ERROR: #{error.message}"
-  puts error.backtrace.join("\n")
-  exit
-end
-
-addresses.each do |address|
-  begin
-    messenger.subscribe(address)
-  rescue Qpid::Proton::ProtonError => error
-    puts "ERROR: #{error.message}"
-    exit
-  end
-end
-
-msg = Qpid::Proton::Message.new
-
-loop do
-  begin
-    messenger.receive(10)
-  rescue Qpid::Proton::ProtonError => error
-    puts "ERROR: #{error.message}"
-    exit
-  end
-
-  while messenger.incoming.nonzero?
-    begin
-      messenger.get(msg)
-    rescue Qpid::Proton::Error => error
-      puts "ERROR: #{error.message}"
-      exit
-    end
-
-    puts "Address: #{msg.address}"
-    subject = msg.subject || "(no subject)"
-    puts "Subject: #{subject}"
-    puts "Body: #{msg.body}"
-    puts "Properties: #{msg.properties}"
-    puts "Instructions: #{msg.instructions}"
-    puts "Annotations: #{msg.annotations}"
-  end
-end
-
-messenger.stop
-

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/messenger/send.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/messenger/send.rb b/examples/ruby/messenger/send.rb
deleted file mode 100644
index bdbeb4d..0000000
--- a/examples/ruby/messenger/send.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env ruby
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-require 'qpid_proton'
-require 'optparse'
-
-options = {}
-messages = []
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: send.rb [options] <msg1> ... <msgn>"
-  opts.on("-a", "--address [addr]", "The receiver's address (def. 0.0.0.0)") do |f|
-    options[:address] = f
-  end
-
-  opts.parse!
-
-  messages = ARGV
-end
-
-options[:address] = "0.0.0.0" unless options[:address]
-messages << "Hello world!" if messages.empty?
-
-messenger = Qpid::Proton::Messenger::Messenger.new
-messenger.start
-msg = Qpid::Proton::Message.new
-
-messages.each do |message|
-  msg.address = options[:address]
-  msg.subject = "How are you?"
-  msg["sent"] = Time.new
-  msg["hostname"] = ENV["HOSTNAME"]
-  msg.instructions["fold"] = "yes"
-  msg.instructions["spindle"] = "no"
-  msg.instructions["mutilate"] = "no"
-  msg.annotations["version"] = 1.0
-  msg.annotations["pill"] = :RED
-  msg.body = message
-
-  begin
-    messenger.put(msg)
-  rescue Qpid::Proton::ProtonError => error
-    puts "ERROR: #{error.message}"
-    exit
-  end
-end
-
-begin
-  messenger.send
-rescue Qpid::Proton::ProtonError => error
-  puts "ERROR: #{error.message}"
-  puts error.backtrace.join("\n")
-  exit
-end
-
-puts "SENT: " + messages.join(",")
-
-messenger.stop

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/README.md
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/README.md b/examples/ruby/reactor/README.md
deleted file mode 100644
index 38cc6ba..0000000
--- a/examples/ruby/reactor/README.md
+++ /dev/null
@@ -1,103 +0,0 @@
-## What Is The Reactor?
-
-A little outside of the scope of this document, but the reactor is an event source for letting an application know about events in the Proton messaging system. With this set of APIs an application can be register handlers that are notified when a connection is created, a message received, or a session closes.
-
-### Handlers
-
-An application creates **handlers**, objects which provide methods through which the reactor notifies the application's components of events and allows them each to handle the ones in which they are interested (see the Chain Of Responsibility design pattern for more on this idea). There are some pre-defined handlers for responding to incoming message events, outgoing message events, data flow and managing the AMQP endpoints. Look in the **Qpid::Proton::Handlers** package for more details on these classes.
-
-## Simple Reactor Examples
-
-### The Broker
-
-The reactor examples come with a sample broker which can be used by other examples and which also works as an example itself. For now we'll just start up the broker example and tell it to listen on port 8888:
-
-````
-$ ruby ../examples/ruby/reactor/broker.rb  --address=0.0.0.0:8888
-Listening on 0.0.0.0:8888
-````
-
-This example broker will receive messages, create queues as needed, and deliver messages to endpoints.
-
-### Hello World Using A Broker
-
-Our first example creates an endpoint that sends messages to a queue to which it is subscribed. So it both sends and receives its message in one pass.
-
-To start it, simply run:
-
-```
-$ ruby ../examples/ruby/reactor/helloworld.rb --address=0.0.0.0:8888 --queue=examples
-Hello world!
-```
-
-As you can see, the classic message was output by the example. Now let's take a look at what's going on under the covers.
-
-#### Events When Talking To A Broker
-
-The following events occur while **helloworld.rb** runs:
-
- * **on_start** - Fired when the application is started.
- * **on_sendable** - Fired when a message can be sent.
- * **on_message** - Fired when a message is received.
-
-### Hello World Without A Broker required
-
-The next example we'll look at will send the classic "Hello world" message to itself directly. This example shows some very fundamental elements of the reactor APIs that you should understand.
-
-To launch the example:
-
-```
- $ ruby helloworld_direct.rb --address=0.0.0.0:8888/examples
- Hello world!
-```
-
-Not very different from the example that uses the broker, which is what we'd expect from the outside. But let's take a look inside of the example and see how it's different at that level
-
-The direct version takes on the responsibility for listening to incoming connections as well as making an outgoing connection. So we see the following additional events occurring:
-
- * **on_accepted** - Fired when a message is received.
- * **on_connection_closed** - Fired when an endpoint closes its connection.
-
-## More Complex Reactor Examples
-
-Now that we've covered the basics with the archetypical hello world app, let's look at some more interesting examples.
-
-There are four example applications that demonstrate how to send and receive messages both directly and through an intermediary, such as a broker:
-
- * **simple_send.rb** - sends messages to a receiver at a specific address and receives responses via an intermediary,
- * **simple_recv.rb** - receives messages from via an intermediary,
- * **direct_send.rb** - sends messages directly to a receiver and listens for responses itself, and
- * **direct_recv.rb** - receives messages directly.
-
- Simple send and direct send may, at first, seem to be so similar that you wonder why they're not just the same applciation. And I know for me I was wonder as I wrote the list above why there were two examples. The reason is that **simple_send.rb** uses the intermediary transfer responses to the messages it sends, while **direct_send.rb** uses an *Acceptor* to listen for an process responses.
-
- You can use the examples in the follow ways:
-
- ```
- simple_send.rb -> broker <- simple_recv.rb
- simple_send.rb -> direct_recv.rb
- direct_send.rb -> simple_recv.rb
- ```
-
-In this set of examples we see the following event occurring, in addition to what we've seen before:
-
- * **on_disconnected** - Fired when the transport is closed.
-
-## Now About That Broker example
-
-The **broker.rb** example application is a nice demonstration of doing something more interesting in Ruby with Proton.
-
-The way the broker works is to listen to incoming connections, examine the components of the address for that connection, attach that connection to an exchange managing that address and then it sends any messages destined for that address to them.
-
-The components of the broker example include:
- * **Broker** - A class that extends the MessagingHandler class. It accepts incoming connections, manages subscribing them to exchanges, and transfers messages between them.
- * **Exchange** - A class that represents a message queue, tracking what endpoints are subscribed to it.
-
-The Broker manages a map connecting a queue address to the instance of Exchange that holds references to the endpoints of interest.
-
-The broker application demonstrates a new set of reactor events:
-
- * **on_link_opening** - Fired when a remote link is opened but the local end is not yet open. From this event the broker grabs the address and subscribes the link to an exchange for that address.
- * **on_link_closing** - Fired when a remote link is closed but the local end is still open. From this event the broker grabs the address and unsubscribes the link from that exchange.
- * **on_connection_closing** - Fired when a remote connection is closed but the local end is still open.
- * **on_disconnected** - Fired when the protocol transport has closed. The broker removes all links for the disconnected connection, avoiding workign with endpoints that are now gone.

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/broker.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/broker.rb b/examples/ruby/reactor/broker.rb
deleted file mode 100644
index 7882d9a..0000000
--- a/examples/ruby/reactor/broker.rb
+++ /dev/null
@@ -1,200 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-require 'pathname'
-
-require_relative '../lib/debugging'
-
-class Exchange
-
-  include Debugging
-
-  def initialize(dynamic = false)
-    @dynamic = dynamic
-    @queue = Queue.new
-    @consumers = []
-  end
-
-  def subscribe(consumer)
-    debug("subscribing #{consumer}") if $options[:debug]
-    @consumers << (consumer)
-    debug(" there are #{@consumers.size} consumers") if $options[:debug]
-  end
-
-  def unsubscribe(consumer)
-    debug("unsubscribing #{consumer}") if $options[:debug]
-    if @consumers.include?(consumer)
-      @consumers.delete(consumer)
-    else
-      debug(" consumer doesn't exist") if $options[:debug]
-    end
-    debug("  there are #{@consumers.size} consumers") if $options[:debug]
-    @consumers.empty? && (@dynamic || @queue.empty?)
-  end
-
-  def publish(message)
-    debug("queueing message: #{message.body}") if $options[:debug]
-    @queue << message
-    self.dispatch
-  end
-
-  def dispatch(consumer = nil)
-    debug("dispatching: consumer=#{consumer}") if $options[:debug]
-    if consumer
-      c = [consumer]
-    else
-      c = @consumers
-    end
-
-    while self.deliver_to(c) do
-    end
-  end
-
-  def deliver_to(consumers)
-    debug("delivering to #{consumers.size} consumer(s)") if $options[:debug]
-    result = false
-    consumers.each do |consumer|
-      debug(" current consumer=#{consumer} credit=#{consumer.credit}") if $options[:debug]
-      if consumer.credit > 0 && !@queue.empty?
-        consumer.send(@queue.pop(true))
-        result = true
-      end
-    end
-    return result
-  end
-
-end
-
-class Broker < Qpid::Proton::Handler::MessagingHandler
-
-  include Debugging
-
-  def initialize(url)
-    super()
-    @url = url
-    @queues = {}
-  end
-
-  def on_start(event)
-    debug("on_start event") if $options[:debug]
-    @acceptor = event.container.listen(@url)
-    print "Listening on #{@url}\n"
-  end
-
-  def queue(address)
-    debug("fetching queue for #{address}: (there are #{@queues.size} queues)") if $options[:debug]
-    unless @queues.has_key?(address)
-      debug(" creating new queue") if $options[:debug]
-      @queues[address] = Exchange.new
-    else
-      debug(" using existing queue") if $options[:debug]
-    end
-    result = @queues[address]
-    debug(" returning #{result}") if $options[:debug]
-    return result
-  end
-
-  def on_link_opening(event)
-    debug("processing on_link_opening") if $options[:debug]
-    debug("link is#{event.link.sender? ? '' : ' not'} a sender") if $options[:debug]
-    if event.link.sender?
-      if event.link.remote_source.dynamic?
-        address = SecureRandom.uuid
-        event.link.source.address = address
-        q = Exchange.new(true)
-        @queues[address] = q
-        q.subscribe(event.link)
-      elsif event.link.remote_source.address
-        event.link.source.address = event.link.remote_source.address
-        self.queue(event.link.source.address).subscribe(event.link)
-      end
-    elsif event.link.remote_target.address
-      event.link.target.address = event.link.remote_target.address
-    end
-  end
-
-  def unsubscribe(link)
-    debug("unsubscribing #{link.address}") if $options[:debug]
-    if @queues.has_key?(link.source.address)
-      if @queues[link.source.address].unsubscribe(link)
-        @queues.delete(link.source.address)
-      end
-    end
-  end
-
-  def on_link_closing(event)
-    self.unsubscribe(event.link) if event.link.sender?
-  end
-
-  def on_connection_closing(event)
-    self.remove_stale_consumers(event.connection)
-  end
-
-  def on_disconnected(event)
-    self.remove_stale_consumers(event.connection)
-  end
-
-  def remove_stale_consumers(connection)
-    l = connection.link_head(Qpid::Proton::Endpoint::REMOTE_ACTIVE)
-    while !l.nil?
-      self.unsubscribe(l) if l.sender?
-      l = l.next(Qpid::Proton::Endpoint::REMOTE_ACTIVE)
-    end
-  end
-
-  def on_sendable(event)
-    debug("on_sendable event") if $options[:debug]
-    q = self.queue(event.link.source.address)
-    debug(" dispatching #{event.message} to #{q}") if $options[:debug]
-    q.dispatch(event.link)
-  end
-
-  def on_message(event)
-    debug("on_message event") if $options[:debug]
-    q = self.queue(event.link.target.address)
-    debug(" dispatching #{event.message} to #{q}") if $options[:debug]
-    q.publish(event.message)
-  end
-
-end
-
-$options = {
-  :address => "localhost:5672",
-  :debug => false
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: #{Pathname.new(__FILE__).basename} [$options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{$options[:address]}).") do |address|
-    $options[:address] = address
-  end
-
-  opts.on("-d", "--debug", "Enable debugging output (def. #{$options[:debug]})") do
-    $options[:debug] = true
-  end
-
-end.parse!
-
-begin
-  Qpid::Proton::Reactor::Container.new(Broker.new($options[:address])).run
-rescue Interrupt
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/client.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/client.rb b/examples/ruby/reactor/client.rb
deleted file mode 100644
index 8c38f38..0000000
--- a/examples/ruby/reactor/client.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-class Client < Qpid::Proton::Handler::MessagingHandler
-
-  def initialize(url, requests)
-    super()
-    @url = url
-    @requests = requests
-  end
-
-  def on_start(event)
-    @sender = event.container.create_sender(@url)
-    @receiver = event.container.create_receiver(@sender.connection, :dynamic => true)
-  end
-
-  def next_request
-    if @receiver.remote_source.address
-      req = Qpid::Proton::Message.new
-      req.reply_to = @receiver.remote_source.address
-      req.body = @requests.first
-      puts "-> #{req.body}"
-      @sender.send(req)
-    end
-  end
-
-  def on_link_opened(event)
-    if event.receiver == @receiver
-      next_request
-    end
-  end
-
-  def on_message(event)
-    puts "<- #{event.message.body}"
-    @requests.delete_at(0)
-    if !@requests.empty?
-      next_request
-    else
-      event.connection.close
-    end
-  end
-
-  def on_transport_error(event)
-    raise "Connection error: #{event.transport.condition}"
-  end
-
-end
-
-REQUESTS = ["Twas brillig, and the slithy toves",
-            "Did gire and gymble in the wabe.",
-            "All mimsy were the borogroves,",
-            "And the mome raths outgrabe."]
-
-options = {
-  :address => "localhost:5672/examples",
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: client.rb [options]"
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") { |address| options[:address] = address }
-end.parse!
-
-Qpid::Proton::Reactor::Container.new(Client.new(options[:address], REQUESTS)).run

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/direct_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/direct_recv.rb b/examples/ruby/reactor/direct_recv.rb
deleted file mode 100644
index 2e19b04..0000000
--- a/examples/ruby/reactor/direct_recv.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-require_relative '../lib/send_and_receive'
-
-class DirectReceive < ExampleReceive
-
-  def initialize(url, expected)
-    super
-  end
-
-  def on_start(event)
-    @acceptor = event.container.listen(self.url)
-  end
-
-  def on_message(event)
-    super(event)
-    @acceptor.close if self.finished?
-  end
-
-end
-
-options = {
-  :address => "localhost:5672/examples",
-  :messages => 100,
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: simple_send.rb [options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
-    options[:address] = address
-  end
-
-  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
-    OptionParser::DecimalInteger) do |messages|
-    options[:messages] = messages
-  end
-end.parse!
-
-Qpid::Proton::Reactor::Container.new(DirectReceive.new(options[:address], options[:messages])).run

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/direct_send.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/direct_send.rb b/examples/ruby/reactor/direct_send.rb
deleted file mode 100644
index 22ce7de..0000000
--- a/examples/ruby/reactor/direct_send.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-require_relative '../lib/send_and_receive'
-
-options = {
-  :address => "localhost:5672/examples",
-  :messages => 100,
-}
-
-class SimpleSend < ExampleSend
-
-  def initialize(url, messages)
-    super(url, messages)
-  end
-
-  def on_start(event)
-    @acceptor = event.container.listen(url)
-  end
-
-end
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: simple_send.rb [options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
-    options[:address] = address
-  end
-
-  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
-    OptionParser::DecimalInteger) do |messages|
-    options[:messages] = messages
-  end
-end.parse!
-
-begin
-  Qpid::Proton::Reactor::Container.new(SimpleSend.new(options[:address], options[:messages])).run
-rescue Interrupt => error
-  puts "ERROR: #{error}"
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/helloworld.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/helloworld.rb b/examples/ruby/reactor/helloworld.rb
deleted file mode 100644
index 9b02e8a..0000000
--- a/examples/ruby/reactor/helloworld.rb
+++ /dev/null
@@ -1,73 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-class HelloWorld < Qpid::Proton::Handler::MessagingHandler
-
-  def initialize(server, address)
-    super()
-    @server = server
-    @address = address
-  end
-
-  def on_start(event)
-    conn = event.container.connect(:address => @server)
-    event.container.create_sender(conn, :target => @address)
-    event.container.create_receiver(conn, :source => @address)
-  end
-
-  def on_sendable(event)
-    msg = Qpid::Proton::Message.new
-    msg.body = "Hello world!"
-    event.sender.send(msg)
-    event.sender.close
-  end
-
-  def on_message(event)
-    puts event.message.body
-    event.connection.close
-  end
-
-  def on_transport_error(event)
-    raise "Connection error: #{event.transport.condition}"
-  end
-end
-
-options = {
-  :address => "localhost:5672",
-  :queue => "examples"
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: helloworld_direct.rb [options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
-    options[:address] = address
-  end
-
-  opts.on("-q", "--queue=QUEUE", "Send messages to QUEUE (def. #{options[:queue]})") do |queue|
-    options[:queue] = queue
-  end
-
-end.parse!
-
-hw = HelloWorld.new(options[:address], "examples")
-Qpid::Proton::Reactor::Container.new(hw).run

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/helloworld_direct.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/helloworld_direct.rb b/examples/ruby/reactor/helloworld_direct.rb
deleted file mode 100644
index e98cc1f..0000000
--- a/examples/ruby/reactor/helloworld_direct.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-options = {
-  :address => "localhost:5672/examples",
-}
-
-class HelloWorldDirect < Qpid::Proton::Handler::MessagingHandler
-
-  include Qpid::Proton::Util::Wrapper
-
-  def initialize(url)
-    super()
-    @url = url
-  end
-
-  def on_start(event)
-    @acceptor = event.container.listen(@url)
-    event.container.create_sender(@url)
-  end
-
-  def on_sendable(event)
-    msg = Qpid::Proton::Message.new
-    msg.body = "Hello world!"
-    event.sender.send(msg)
-    event.sender.close
-  end
-
-  def on_message(event)
-    puts "#{event.message.body}"
-  end
-
-  def on_accepted(event)
-    event.connection.close
-  end
-
-  def on_connection_closed(event)
-    @acceptor.close
-  end
-
-end
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: helloworld_direct.rb [options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
-    options[:address] = address
-  end
-
-end.parse!
-
-begin
-  Qpid::Proton::Reactor::Container.new(HelloWorldDirect.new(options[:address])).run
-rescue Interrupt => error
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/server.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/server.rb b/examples/ruby/reactor/server.rb
deleted file mode 100644
index 9373272..0000000
--- a/examples/ruby/reactor/server.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-class Server < Qpid::Proton::Handler::MessagingHandler
-
-  def initialize(url)
-    super()
-    @url = Qpid::Proton::URL.new url
-    @address = @url.path
-    @senders = {}
-  end
-
-  def on_start(event)
-    @container = event.container
-    @conn = @container.connect(:url => @url)
-    @receiver = @container.create_receiver(@conn, :source => @address)
-    @relay = nil
-  end
-
-  def on_connection_opened(event)
-    if event.connection.remote_offered_capabilities &&
-      event.connection.remote_offered_capabilities.contain?("ANONYMOUS-RELAY")
-      @relay = @container.create_sender(@conn, nil)
-    end
-  end
-
-  def on_message(event)
-    msg = event.message
-    puts "<- #{msg.body}"
-    sender = @relay || @senders[msg.reply_to]
-    if sender.nil?
-      sender = @container.create_sender(@conn, :target => msg.reply_to)
-      @senders[msg.reply_to] = sender
-    end
-    reply = Qpid::Proton::Message.new
-    reply.address = msg.reply_to
-    reply.body = msg.body.upcase
-    puts "-> #{reply.body}"
-    reply.correlation_id = msg.correlation_id
-    sender.send(reply)
-  end
-
-  def on_transport_error(event)
-    raise "Connection error: #{event.transport.condition}"
-  end
-end
-
-options = {
-  :address => "localhost:5672/examples",
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: server.rb [options]"
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") { |address| options[:address] = address }
-end.parse!
-
-Qpid::Proton::Reactor::Container.new(Server.new(options[:address])).run()

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/simple_recv.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/simple_recv.rb b/examples/ruby/reactor/simple_recv.rb
deleted file mode 100644
index 55a37ee..0000000
--- a/examples/ruby/reactor/simple_recv.rb
+++ /dev/null
@@ -1,58 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-require_relative '../lib/send_and_receive'
-
-class Receiver < ExampleReceive
-
-  def initialize(url, count)
-    super(url, count)
-  end
-
-  def on_start(event)
-    event.container.create_receiver(@url)
-  end
-
-end
-
-options = {
-  :address => "localhost:5672/examples",
-  :messages => 100,
-}
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: simple_send.rb [options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
-    options[:address] = address
-  end
-
-  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
-    OptionParser::DecimalInteger) do |messages|
-    options[:messages] = messages
-  end
-end.parse!
-
-begin
-  Qpid::Proton::Reactor::Container.new(Receiver.new(options[:address], options[:messages])).run
-rescue Interrupt
-end

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/reactor/simple_send.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/reactor/simple_send.rb b/examples/ruby/reactor/simple_send.rb
deleted file mode 100644
index 1dd4150..0000000
--- a/examples/ruby/reactor/simple_send.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'optparse'
-
-require_relative '../lib/send_and_receive'
-
-options = {
-  :address => "localhost:5672/examples",
-  :messages => 100,
-}
-
-class SimpleSend < ExampleSend
-
-  def initialize(url, messages)
-    super(url, messages)
-  end
-
-  def on_start(event)
-    event.container.create_sender(url)
-  end
-
-end
-
-OptionParser.new do |opts|
-  opts.banner = "Usage: simple_send.rb [options]"
-
-  opts.on("-a", "--address=ADDRESS", "Send messages to ADDRESS (def. #{options[:address]}).") do |address|
-    options[:address] = address
-  end
-
-  opts.on("-m", "--messages=COUNT", "The number of messages to send (def. #{options[:messages]}",
-    OptionParser::DecimalInteger) do |messages|
-    options[:messages] = messages
-  end
-end.parse!
-
-Qpid::Proton::Reactor::Container.new(SimpleSend.new(options[:address], options[:messages])).run

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/registry_test.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/registry_test.rb b/examples/ruby/registry_test.rb
deleted file mode 100644
index b4b1f6c..0000000
--- a/examples/ruby/registry_test.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-require 'weakref'
-
-def show_registry(registry)
-  registry.each_pair do |key, value|
-    registry.delete(key) if value.weakref_alive?
-  end
-  puts "The contents of the registry: size=#{registry.size}"
-end
-
-def show_object_count(clazz)
-  puts "There are #{ObjectSpace.each_object(clazz).count} instances of #{clazz}."
-end
-
-impl = Cproton.pn_transport
-implclazz = impl.class
-transport = Qpid::Proton::Transport.wrap(impl)
-
-puts "Initial setup:"
-show_object_count(Qpid::Proton::Transport)
-show_object_count(implclazz)
-
-transport = nil
-
-show_registry(Qpid::Proton.registry)
-
-ObjectSpace.garbage_collect
-
-puts "After garbage collection:"
-show_object_count(Qpid::Proton::Transport)
-show_object_count(implclazz)
-
-MAXCOUNT=100000
-(1..MAXCOUNT).each do |which|
-  nimpl = Cproton.pn_transport
-  Cproton.pn_incref(nimpl)
-  transport = Qpid::Proton::Transport.wrap(nimpl)
-  transport = Qpid::Proton::Transport.wrap(nimpl)
-end
-
-transport = nil
-
-puts "After creating #{MAXCOUNT} instances"
-show_object_count(Qpid::Proton::Transport)
-show_object_count(implclazz)
-show_registry(Qpid::Proton.registry)
-
-ObjectSpace.garbage_collect
-
-transport = Qpid::Proton::Transport.wrap(impl)
-
-puts "After garbage collection:"
-puts "impl=#{impl}"
-puts "transport=#{transport}"
-show_object_count(Qpid::Proton::Transport)
-show_object_count(implclazz)
-show_registry(Qpid::Proton.registry)

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/examples/ruby/wrapper_test.rb
----------------------------------------------------------------------
diff --git a/examples/ruby/wrapper_test.rb b/examples/ruby/wrapper_test.rb
deleted file mode 100644
index ca7e250..0000000
--- a/examples/ruby/wrapper_test.rb
+++ /dev/null
@@ -1,82 +0,0 @@
-#--
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#++
-
-require 'qpid_proton'
-
-def how_many_transports?(expected)
-  count = ObjectSpace.each_object(Qpid::Proton::Transport).count
-  if expected.min == expected.max
-    expectation = "#{expected.min}"
-  else
-    expectation = "#{expected.min} <= count <= #{expected.max}"
-  end
-  puts "Transport count: found #{count}, expected #{expectation} (#{expected.include?(count) ? 'Good' : 'Bad'})"
-end
-
-transport = Qpid::Proton::Transport.new
-timpl = transport.impl
-
-puts "================================="
-puts "= Storing my original transport ="
-puts "================================="
-puts "   Stored transport=#{transport} (#{Cproton.pni_address_of(timpl).to_s(16)})"
-how_many_transports?(1..1)
-puts "================================="
-transport.instance_eval { @first_name = "Darryl"; @last_name = "Pierce", @instance_id = 717 }
-transport = nil
-
-
-puts ""
-max = 1000
-puts "Creating #{max} instances of Transport"
-(0...max).each do |which|
-  t = Qpid::Proton::Transport.new
-  t.instance_eval { @instance_id = which }
-  t = nil
-end
-
-puts ""
-puts "===================================="
-puts "= Retrieving my original transport ="
-puts "===================================="
-transport = Qpid::Proton::Transport.wrap(timpl)
-puts "Retrieved transport=#{transport} (#{Cproton.pni_address_of(timpl).to_s(16)})"
-how_many_transports?(1..1001)
-puts "===================================="
-puts "My transport attributes:"
-puts transport
-
-transport = nil
-GC.start
-how_many_transports?(1..1)
-
-puts ""
-puts "======================================"
-puts "= Throwing away the Transport object ="
-puts "======================================"
-transport = nil
-timpl.instance_eval { @proton_wrapper = nil }
-GC.start
-begin
-  transport = Qpid::Proton::Transport.wrap(timpl)
-  puts "!!! This should fail!"
-rescue Qpid::Proton::ProtonError => error
-  puts "Good, it failed..."
-end
-how_many_transports?(0..0)

http://git-wip-us.apache.org/repos/asf/qpid-proton-j/blob/2f85988e/proton-c/.gitignore
----------------------------------------------------------------------
diff --git a/proton-c/.gitignore b/proton-c/.gitignore
deleted file mode 100644
index 223c5c6..0000000
--- a/proton-c/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-*.pyc
-*.o
-*.d
-src/codec/encodings.h
-src/protocol.h
-src/proton
-src/test
-src/libqpidproton.so


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org