class Qpid::Proton::Receiver

The receiving endpoint.

@see Sender

Constants

PROTON_METHOD_PREFIX

@private

Public Instance Methods

flow(n) click to toggle source

Grants credit for incoming deliveries.

@param n [Integer] The amount to increment the link credit.

# File lib/core/receiver.rb, line 63
def flow(n)
  Cproton.pn_link_flow(@impl, n)
end
receive(limit) click to toggle source

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.

@param limit [Integer] The maximum bytes to receive.

@return [Integer, nil] The number of bytes received, or nil if the end of the stream was reached.t

@see Deliver#pending To see how much buffer space is needed.

@raise [LinkError] If an error occurs.

# File lib/core/receiver.rb, line 86
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