Class: Qpid::Proton::Receiver
- Defined in:
- lib/core/receiver.rb
Overview
The receiving endpoint.
Constant Summary
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
Instance Attribute Summary collapse
-
#auto_accept ⇒ Boolean
readonly
Auto_accept flag, see #open.
-
#credit_window ⇒ Integer
readonly
Credit window, see #open.
Instance Method Summary collapse
-
#flow(n)
Grants credit for incoming deliveries.
-
#open(opts = nil)
Open Receiver link.
-
#receive(limit) ⇒ Integer?
Allows receiving up to the specified limit of data from the remote endpoint.
Methods inherited from Link
#==, #advance, #close, #connection, #current, #delivery, #drained, #error, #next, #rcv_settle_mode, #rcv_settle_mode=, #remote_source, #remote_target, #session, #snd_settle_mode, #snd_settle_mode=, #source, #target
Methods inherited from Endpoint
#closed?, #local_closed?, #local_open?, #local_uninit?, #open?, #remote_closed?, #remote_open?, #remote_uninit?, #transport, #work_queue
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 |
Instance Method Details
#flow(n)
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) #open_receiver(opts)
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 |