class Qpid::Proton::Delivery

A Delivery maintains detail on the delivery of data to an endpoint.

A Delivery has a single parent Qpid::Proton::Link

@example

# SCENARIO: An event comes in notifying that data has been delivered to
#           the local endpoint. A Delivery object can be used to check
#           the details of the delivery.

delivery = @event.delivery
if delivery.readable? && !delivery.partial?
  # decode the incoming message
  msg = Qpid::Proton::Message.new
  msg.decode(link.receive(delivery.pending))
end

Constants

PROTON_METHOD_PREFIX

@private

Public Class Methods

new(impl) click to toggle source

@private

# File lib/core/delivery.rb, line 51
def initialize(impl)
  @impl = impl
  @local = Disposition.new(Cproton.pn_delivery_local(impl), true)
  @remote = Disposition.new(Cproton.pn_delivery_remote(impl), false)
  self.class.store_instance(self, :pn_delivery_attachments)
end

Public Instance Methods

connection() click to toggle source

Returns the parent connection.

@return [Connection] The connection.

# File lib/core/delivery.rb, line 207
def connection
  self.session.connection
end
local_accepted?() click to toggle source

@private

# File lib/core/delivery.rb, line 230
def local_accepted?
  self.local_state == Disposition::ACCEPTED
end
local_modified?() click to toggle source

@private

# File lib/core/delivery.rb, line 260
def local_modified?
  self.local_state == Disposition::MODIFIED
end
local_received?() click to toggle source

@private

# File lib/core/delivery.rb, line 220
def local_received?
  self.local_state == Disposition::RECEIVED
end
local_rejected?() click to toggle source

@private

# File lib/core/delivery.rb, line 240
def local_rejected?
  self.local_state == Disposition::REJECTED
end
local_released?() click to toggle source

@private

# File lib/core/delivery.rb, line 250
def local_released?
  self.local_state == Disposition::RELEASED
end
local_state() click to toggle source

Returns the local disposition state for the delivery.

@return [Disposition] The local disposition state.

# File lib/core/delivery.rb, line 165
def local_state
  Cproton.pn_delivery_local_state(@impl)
end
remote_accepted?() click to toggle source

@private

# File lib/core/delivery.rb, line 235
def remote_accepted?
  self.remote_state == Disposition::ACCEPTED
end
remote_modified?() click to toggle source

@private

# File lib/core/delivery.rb, line 265
def remote_modified?
  self.remote_state == Disposition::MODIFIED
end
remote_received?() click to toggle source

@private

# File lib/core/delivery.rb, line 225
def remote_received?
  self.remote_state == Disposition::RECEIVED
end
remote_rejected?() click to toggle source

@private

# File lib/core/delivery.rb, line 245
def remote_rejected?
  self.remote_state == Disposition::REJECTED
end
remote_released?() click to toggle source

@private

# File lib/core/delivery.rb, line 255
def remote_released?
  self.remote_state == Disposition::RELEASED
end
remote_state() click to toggle source

Returns the remote disposition state for the delivery.

@return [Disposition] The remote disposition state.

# File lib/core/delivery.rb, line 173
def remote_state
  Cproton.pn_delivery_remote_state(@impl)
end
session() click to toggle source

Returns the parent session.

@return [Session] The session.

# File lib/core/delivery.rb, line 199
def session
  self.link.session
end
transport() click to toggle source

Returns the parent transport.

@return [Transport] The transport.

# File lib/core/delivery.rb, line 215
def transport
  self.connection.transport
end
update(state) click to toggle source
# File lib/core/delivery.rb, line 153
def update(state)
  impl = @local.impl
  object_to_data(@local.data, Cproton.pn_disposition_data(impl))
  object_to_data(@local.annotations, Cproton.pn_disposition_annotations(impl))
  object_to_data(@local.condition, Cproton.pn_disposition_condition(impl))
  Cproton.pn_delivery_update(@impl, state)
end
work_next() click to toggle source

Returns the next delivery on the connection that has pending operations.

@return [Delivery, nil] The next delivery, or nil if there are none.

@see Qpid::Proton::Connection#work_head

# File lib/core/delivery.rb, line 183
def work_next
  Delivery.wrap(Cproton.pn_work_next(@impl))
end