The base for both Sender and Receiver, providing common functionality between both ends.
A Link has a single parent Qpid::Proton::Session instance.
@private
The receiver will settle deliveries regardless of what the sender does.
The receiver will only settle deliveries after the sender settles.
The sender may send a mixture of settled and unsettled deliveries.
The sender will send all deliveries settled to the receiver.
The sender will send all deliveries initially unsettled.
@private
# File lib/core/link.rb, line 227 def initialize(impl) @impl = impl self.class.store_instance(self, :pn_link_attachments) end
@private
# File lib/core/link.rb, line 214 def self.wrap(impl) return nil if impl.nil? result = self.fetch_instance(impl, :pn_link_attachments) return result unless result.nil? if Cproton.pn_link_is_sender(impl) return Sender.new(impl) elsif Cproton.pn_link_is_receiver(impl) return Receiver.new(impl) end end
# File lib/core/link.rb, line 380 def ==(other) other.respond_to?(:impl) && (Cproton.pni_address_of(other.impl) == Cproton.pni_address_of(@impl)) end
@private
# File lib/core/link.rb, line 371 def _local_condition Cproton.pn_link_condition(@impl) end
@private
# File lib/core/link.rb, line 376 def _remote_condition Cproton.pn_link_remote_condition(@impl) end
Returns the parent connection.
@return [Connection] The connection.
# File lib/core/link.rb, line 297 def connection self.session.connection end
Returns the current delivery.
Each link maintains a sequence of deliveries in the order they were created, along with a reference to the current delivery. All send and receive operations on a link take place on the current delivery. If a link has no current delivery, the current delivery is automatically pointed to the next delivery created on the link.
Once initialized, the current delivery remains the same until it is changed by advancing, or until it is settled.
@see next @see Delivery#settle
@return [Delivery] The current delivery.
# File lib/core/link.rb, line 325 def current Delivery.wrap(Cproton.pn_link_current(@impl)) end
Returns the parent delivery.
@return [Delivery] The delivery.
# File lib/core/link.rb, line 305 def delivery(tag) Delivery.new(Cproton.pn_delivery(@impl, tag)) end
Returns additional error information.
Whenever a link operation fails (i.e., returns an error code) additional error details can be obtained from this method. Ther error object that is returned may also be used to clear the error condition.
@return [Error] The error.
# File lib/core/link.rb, line 240 def error Cproton.pn_link_error(@impl) end
Returns the next link that matches the given state mask.
@param state_mask [Fixnum] The state mask.
@return [Sender, Receiver] The next link.
# File lib/core/link.rb, line 250 def next(state_mask) return Link.wrap(Cproton.pn_link_next(@impl, state_mask)) end
Returns the local receiver settle mode.
@return [Fixnum] The local receiver settle mode.
# File lib/core/link.rb, line 366 def rcv_settle_mode Cproton.pn_link_rcv_settle_mode(@impl) end
Sets the local receiver settle mode.
@param mode [Fixnum] The settle mode.
@see #RCV_FIRST @see #RCV_SECOND
# File lib/core/link.rb, line 358 def rcv_settle_mode=(mode) Cproton.pn_link_set_rcv_settle_mode(@impl, mode) end
Returns a representation of the remotely defined source terminus.
@return [Terminus] The terminus.
# File lib/core/link.rb, line 273 def remote_source Terminus.new(Cproton.pn_link_remote_source(@impl)) end
Returns a representation of the remotely defined target terminus.
@return [Terminus] The terminus.
# File lib/core/link.rb, line 281 def remote_target Terminus.new(Cproton.pn_link_remote_target(@impl)) end
Returns the parent session.
@return [Session] The session.
# File lib/core/link.rb, line 289 def session Session.wrap(Cproton.pn_link_session(@impl)) end
Returns the local sender settle mode.
@return [Fixnum] The local sender settle mode.
@see snd_settle_mode
# File lib/core/link.rb, line 347 def snd_settle_mode Cproton.pn_link_snd_settle_mode(@impl) end
Sets the local sender settle mode.
@param mode [Fixnum] The settle mode.
@see #SND_UNSETTLED @see #SND_SETTLED @see #SND_MIXED
# File lib/core/link.rb, line 337 def snd_settle_mode=(mode) Cproton.pn_link_set_snd_settle_mode(@impl, mode) end
Returns the locally defined source terminus.
@return [Terminus] The terminus
# File lib/core/link.rb, line 257 def source Terminus.new(Cproton.pn_link_source(@impl)) end
Returns the locally defined target terminus.
@return [Terminus] The terminus.
# File lib/core/link.rb, line 265 def target Terminus.new(Cproton.pn_link_target(@impl)) end