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
@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
Returns the parent connection.
@return [Connection] The connection.
# File lib/core/delivery.rb, line 207 def connection self.session.connection end
Returns the parent link.
@return [Link] The parent link.
# File lib/core/delivery.rb, line 191 def link Link.wrap(Cproton.pn_delivery_link(@impl)) end
@private
# File lib/core/delivery.rb, line 230 def local_accepted? self.local_state == Disposition::ACCEPTED end
@private
# File lib/core/delivery.rb, line 260 def local_modified? self.local_state == Disposition::MODIFIED end
@private
# File lib/core/delivery.rb, line 220 def local_received? self.local_state == Disposition::RECEIVED end
@private
# File lib/core/delivery.rb, line 240 def local_rejected? self.local_state == Disposition::REJECTED end
@private
# File lib/core/delivery.rb, line 250 def local_released? self.local_state == Disposition::RELEASED end
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
@private
# File lib/core/delivery.rb, line 235 def remote_accepted? self.remote_state == Disposition::ACCEPTED end
@private
# File lib/core/delivery.rb, line 265 def remote_modified? self.remote_state == Disposition::MODIFIED end
@private
# File lib/core/delivery.rb, line 225 def remote_received? self.remote_state == Disposition::RECEIVED end
@private
# File lib/core/delivery.rb, line 245 def remote_rejected? self.remote_state == Disposition::REJECTED end
@private
# File lib/core/delivery.rb, line 255 def remote_released? self.remote_state == Disposition::RELEASED end
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
Returns the parent session.
@return [Session] The session.
# File lib/core/delivery.rb, line 199 def session self.link.session end
Returns the parent transport.
@return [Transport] The transport.
# File lib/core/delivery.rb, line 215 def transport self.connection.transport end
# 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
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