Class: Qpid::Proton::Delivery

Inherits:
Object
  • Object
show all
Defined in:
lib/core/delivery.rb

Overview

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

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

Examples:


# 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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#buffered?Boolean (readonly)

A delivery that is buffered has not yet been written to the wire.

Note that returning false does not imply that a delivery was definitely written to the wire. If false is returned, it is not known whether the delivery was actually written to the wire or not.

Returns:

  • (Boolean)

    Returns if the delivery is buffered.



149
# File 'lib/core/delivery.rb', line 149

proton_caller :buffered?

#partial?Boolean (readonly)

Returns if the delivery has only partial message data.

Returns:

  • (Boolean)

    Returns if the delivery has only partial message data.



116
# File 'lib/core/delivery.rb', line 116

proton_caller :partial?

#pendingFixnum (readonly)

delivery.

Returns:

  • (Fixnum)

    Return the amount of pending message data for the



110
# File 'lib/core/delivery.rb', line 110

proton_caller :pending

#readable?Boolean (readonly)

A delivery is considered readable if it is the current delivery on an incoming link.

Returns:

  • (Boolean)

    Returns if a delivery is readable.



86
# File 'lib/core/delivery.rb', line 86

proton_caller :readable?

#settled?Boolean (readonly)

Returns if the delivery is remotely settled.

Returns:

  • (Boolean)

    Returns if the delivery is remotely settled.



122
# File 'lib/core/delivery.rb', line 122

proton_caller :settled?

#tagString (readonly)

Returns The tag for the delivery.

Returns:

  • (String)

    The tag for the delivery.



68
# File 'lib/core/delivery.rb', line 68

proton_caller :tag

#updated?Boolean (readonly)

A delivery is considered updated whenever the peer communicates a new disposition for the dlievery. Once a delivery becomes updated, it will remain so until cleared.

Returns:

  • (Boolean)

    Returns if a delivery is updated.

See Also:



97
# File 'lib/core/delivery.rb', line 97

proton_caller :updated?

#writable?Boolean (readonly)

A delivery is considered writable if it is the current delivery on an outgoing link, and the link has positive credit.

Returns:

  • (Boolean)

    Returns if a delivery is writable.



77
# File 'lib/core/delivery.rb', line 77

proton_caller :writable?

Instance Method Details

#clearObject

Clear the updated flag for a delivery.



103
# File 'lib/core/delivery.rb', line 103

proton_caller :clear

#connectionConnection

Returns the parent connection.

Returns:



207
208
209
# File 'lib/core/delivery.rb', line 207

def connection
  self.session.connection
end

#dumpObject

Utility function for printing details of a delivery.



137
# File 'lib/core/delivery.rb', line 137

proton_caller :dump

Returns the parent link.

Returns:

  • (Link)

    The parent link.



191
192
193
# File 'lib/core/delivery.rb', line 191

def link
  Link.wrap(Cproton.pn_delivery_link(@impl))
end

#local_stateDisposition

Returns the local disposition state for the delivery.

Returns:



165
166
167
# File 'lib/core/delivery.rb', line 165

def local_state
  Cproton.pn_delivery_local_state(@impl)
end

#remote_stateDisposition

Returns the remote disposition state for the delivery.

Returns:



173
174
175
# File 'lib/core/delivery.rb', line 173

def remote_state
  Cproton.pn_delivery_remote_state(@impl)
end

#sessionSession

Returns the parent session.

Returns:



199
200
201
# File 'lib/core/delivery.rb', line 199

def session
  self.link.session
end

#settleObject

Settles a delivery.

A settled delivery can never be used again.


131
# File 'lib/core/delivery.rb', line 131

proton_caller :settle

#transportTransport

Returns the parent transport.

Returns:



215
216
217
# File 'lib/core/delivery.rb', line 215

def transport
  self.connection.transport
end

#update(state) ⇒ Object



153
154
155
156
157
158
159
# 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_nextDelivery?

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

Returns:

  • (Delivery, nil)

    The next delivery, or nil if there are none.

See Also:



183
184
185
# File 'lib/core/delivery.rb', line 183

def work_next
  Delivery.wrap(Cproton.pn_work_next(@impl))
end