You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by mc...@apache.org on 2015/06/18 16:03:54 UTC

[47/50] qpid-proton git commit: PROTON-781: Added support for reactors to the Ruby Endpoint class.

PROTON-781: Added support for reactors to the Ruby Endpoint class.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/e7213586
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/e7213586
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/e7213586

Branch: refs/heads/PROTON-781-ruby-reactor-apis
Commit: e72135860382c099a2a2f8838bb17c9e3d641c2a
Parents: 6598326
Author: Darryl L. Pierce <mc...@gmail.com>
Authored: Thu Apr 16 10:41:08 2015 -0400
Committer: Darryl L. Pierce <mc...@gmail.com>
Committed: Thu Jun 18 09:27:21 2015 -0400

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/core/endpoint.rb | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e7213586/proton-c/bindings/ruby/lib/core/endpoint.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/core/endpoint.rb b/proton-c/bindings/ruby/lib/core/endpoint.rb
index cbf1015..f3ddbcb 100644
--- a/proton-c/bindings/ruby/lib/core/endpoint.rb
+++ b/proton-c/bindings/ruby/lib/core/endpoint.rb
@@ -110,6 +110,31 @@ module Qpid::Proton
       !(self.state & state_mask).zero?
     end
 
+    def handler
+      reactor = Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_object_reactor(@impl))
+      if reactor.nil?
+        on_error = nil
+      else
+        on_error = reactor.method(:on_error)
+      end
+      record = self.attachments
+      puts "record=#{record}"
+      WrappedHandler.wrap(Cproton.pn_record_get_handler(record), on_error)
+    end
+
+    def handler=(handler)
+      reactor = Qpid::Proton::Reactor::Reactor.wrap(Cproton.pn_object_reactor(@impl))
+      if reactor.nil?
+        on_error = nil
+      else
+        on_error = reactor.method(:on_error)
+      end
+      impl = chandler(handler, on_error)
+      record = self.attachments
+      Cproton.pn_record_set_handler(record, impl)
+      Cproton.pn_decref(impl)
+    end
+
   end
 
 end


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