Class: Mqlight::ProtonContainer::DeliveryMessage
- Inherits:
-
Object
- Object
- Mqlight::ProtonContainer::DeliveryMessage
- Includes:
- Logging
- Defined in:
- lib/mqlight/proton_container.rb
Constant Summary collapse
- IS_CLOSED =
Cproton::PN_LOCAL_CLOSED | Cproton::PN_REMOTE_CLOSED \ | Cproton::PN_REMOTE_UNINIT
Instance Method Summary collapse
-
#empty_pop ⇒ Object
Triggers a wake-up with proton.
-
#get ⇒ Object
get a message from the transport head.
-
#initialize(messenger_impl, service, container) ⇒ DeliveryMessage
constructor
A new instance of DeliveryMessage.
Methods included from Logging
Constructor Details
#initialize(messenger_impl, service, container) ⇒ DeliveryMessage
Returns a new instance of DeliveryMessage.
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 |
# File 'lib/mqlight/proton_container.rb', line 800 def initialize(messenger_impl, service, container) logger.entry(@id) { self.class.to_s + '#' + __method__.to_s } parms = Hash[method(__method__).parameters.map do |parm| [parm[1], eval(parm[1].to_s)] end] logger.parms(@id, parms) { self.class.to_s + '#' + __method__.to_s } @container = container @container.synchronize do @pn_connection = Cproton.pn_messenger_resolve(messenger_impl, service.address) @pn_transport = Cproton.pn_connection_transport(@pn_connection) \ unless @pn_connection.nil? end fail(Mqlight::InternalError, "Could not resolve #{service} to a connection") \ if @pn_connection.nil? fail(Mqlight::InternalError, "Could not resolve connection of #{service} to a transport") \ if @pn_transport.nil? logger.exit(@id) { self.class.to_s + '#' + __method__.to_s } end |
Instance Method Details
#empty_pop ⇒ Object
Triggers a wake-up with proton
854 855 856 857 858 859 |
# File 'lib/mqlight/proton_container.rb', line 854 def empty_pop @container.synchronize do Cproton.pn_connection_pop(@pn_connection, 0) \ unless (Cproton.pn_connection_state(@pn_connection) & IS_CLOSED) != 0 end end |
#get ⇒ Object
get a message from the transport head
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
# File 'lib/mqlight/proton_container.rb', line 825 def get logger.entry_often(@id) { self.class.to_s + '#' + __method__.to_s } parms = Hash[method(__method__).parameters.map do |parm| [parm[1], eval(parm[1].to_s)] end] logger.often(@id, parms) { self.class.to_s + '#' + __method__.to_s } msg = nil @container.synchronize do pending_bytes = Cproton.pn_transport_pending(@pn_transport) if pending_bytes > 0 # The patched pn_transport_peek returns two values _length, msg = Cproton.pn_transport_peek( @pn_transport, pending_bytes) Cproton.pn_connection_pop(@pn_connection, pending_bytes) end end logger.often(@id, msg.nil? ? 'nil' : msg.size) \ { self.class.to_s + '#' + __method__.to_s } msg # return rescue => e logger.ffdc(self.class.to_s + '#' + __method__.to_s, 'ffdc008', self, 'Uncaught exception', e) logger.throw(@id, e) { self.class.to_s + '#' + __method__.to_s } raise e end |