Class: Qpid::Proton::Receiver
- Includes:
- Util::Wrapper
- Defined in:
- lib/core/receiver.rb
Overview
The receiving endpoint.
Constant Summary collapse
- PROTON_METHOD_PREFIX =
"pn_link"
Constants inherited from Link
Link::RCV_FIRST, Link::RCV_SECOND, Link::SND_MIXED, Link::SND_SETTLED, Link::SND_UNSETTLED
Constants inherited from Endpoint
Endpoint::LOCAL_ACTIVE, Endpoint::LOCAL_CLOSED, Endpoint::LOCAL_MASK, Endpoint::LOCAL_UNINIT, Endpoint::REMOTE_ACTIVE, Endpoint::REMOTE_CLOSED, Endpoint::REMOTE_MASK, Endpoint::REMOTE_UNINIT
Constants included from Util::Deprecation
Util::Deprecation::DEPRECATE_FULL_TRACE, Util::Deprecation::MATCH_DIR
Instance Attribute Summary collapse
-
#auto_accept ⇒ Boolean
readonly
Auto_accept flag, see #open.
-
#credit_window ⇒ Integer
readonly
Credit window, see #open.
-
#drain ⇒ Boolean
The drain mode.
-
#draining? ⇒ Boolean
readonly
Returns if a link is currently draining.
Attributes included from Util::Wrapper
Attributes inherited from Link
#available, #credit, #name, #queued, #receiver?, #remote_credit, #sender?, #state
Instance Method Summary collapse
-
#flow(n) ⇒ Object
Grants credit for incoming deliveries.
-
#open(opts = nil) ⇒ Object
Open Receiver link.
-
#receive(limit) ⇒ Integer?
Allows receiving up to the specified limit of data from the remote endpoint.
Methods included from Util::Wrapper
included, #inspect, registry, #to_s
Methods inherited from Link
#==, #_local_condition, #_remote_condition, #advance, #close, #connection, #current, #delivery, #detach, #drained, #error, #initialize, #next, #rcv_settle_mode, #rcv_settle_mode=, #remote_source, #remote_target, #session, #snd_settle_mode, #snd_settle_mode=, #source, #target, wrap
Methods inherited from Endpoint
#check_state, #closed?, #condition, #local_closed?, #local_condition, #local_open?, #local_uninit?, #open?, #remote_closed?, #remote_condition, #remote_open?, #remote_uninit?, #transport, #work_queue
Methods included from Util::Deprecation
deprecated, #deprecated, included
Constructor Details
This class inherits a constructor from Qpid::Proton::Link
Instance Attribute Details
#auto_accept ⇒ Boolean (readonly)
Returns auto_accept flag, see #open.
62 63 64 |
# File 'lib/core/receiver.rb', line 62 def auto_accept @auto_accept end |
#credit_window ⇒ Integer (readonly)
Returns credit window, see #open.
59 60 61 |
# File 'lib/core/receiver.rb', line 59 def credit_window @credit_window end |
#drain ⇒ Boolean
The drain mode.
If a receiver is in drain mode, then the sending endpoint of a link must immediately use up all available credit on the link. If this is not possible, the excess credit must be returned by invoking #drained.
Only the receiving endpoint can set the drain mode.
76 |
# File 'lib/core/receiver.rb', line 76 proton_set_get :drain |
#draining? ⇒ Boolean (readonly)
Returns if a link is currently draining.
A link is defined to be draining when drain mode is set to true and the sender still has excess credit.
87 |
# File 'lib/core/receiver.rb', line 87 proton_caller :draining? |
Instance Method Details
#flow(n) ⇒ Object
Grants credit for incoming deliveries.
93 94 95 |
# File 'lib/core/receiver.rb', line 93 def flow(n) Cproton.pn_link_flow(@impl, n) end |
#open_receiver(address) ⇒ Object #open_receiver(opts) ⇒ Object
Open Qpid::Proton::Receiver link
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/core/receiver.rb', line 46 def open(opts=nil) opts ||= {} opts = { :source => opts } if opts.is_a? String @credit_window = opts.fetch(:credit_window, 10) @auto_accept = opts.fetch(:auto_accept, true) source.apply(opts[:source]) target.apply(opts[:target]) source.dynamic = !!opts[:dynamic] super() self end |
#receive(limit) ⇒ Integer?
Allows receiving up to the specified limit of data from the remote endpoint.
Note that large messages can be streamed across the network, so just because there is no data to read does not imply the message is complete.
To ensure the entirety of the message data has been read, either call #receive until nil is returned, or verify that #partial? is false and Delivery#pending is 0.
the stream was reached.
116 117 118 119 120 121 |
# File 'lib/core/receiver.rb', line 116 def receive(limit) (n, bytes) = Cproton.pn_link_recv(@impl, limit) return nil if n == Qpid::Proton::Error::EOS raise LinkError.new("[#{n}]: #{Cproton.pn_link_error(@impl)}") if n < 0 return bytes end |