class Qpid::Proton::Session
A session is the parent for senders and receivers.
A Session has a single parent Qpid::Proton::Connection instance.
Constants
- PROTON_METHOD_PREFIX
@private
Public Class Methods
@private
# File lib/core/session.rb, line 85 def initialize(impl) @impl = impl self.class.store_instance(self, :pn_session_attachments) end
@private
# File lib/core/session.rb, line 79 def self.wrap(impl) return nil if impl.nil? self.fetch_instance(impl, :pn_session_attachments) || Session.new(impl) end
Public Instance Methods
@private
# File lib/core/session.rb, line 152 def _local_condition Cproton.pn_session_condition(@impl) end
Closed the session.
Once this operation has completed, the state flag will be set. This may be called without calling open, in which case it is the equivalence of calling open and then close immediately.
# File lib/core/session.rb, line 96 def close self._update_condition Cproton.pn_session_close(@impl) end
Returns the parent connection.
@return [Connection] The connection.
# File lib/core/session.rb, line 119 def connection Connection.wrap(Cproton.pn_session_connection(@impl)) end
Retrieves the next session from a given connection that matches the specified state mask.
When uses with Qpid::Proton::Connection#session_head an application can access all of the session son the connection that match the given state.
@param state_mask [Fixnum] The state mask to match.
@return [Session, nil] The next session if one matches, or nil.
# File lib/core/session.rb, line 111 def next(state_mask) Session.wrap(Cproton.pn_session_next(@impl, state_mask)) end
Constructs a new receiver.
Each receiver between two AMQP containers must be uniquely named. Note that this uniqueness cannot be enforced at the library level, so some consideration should be taken in choosing link names.
@param name [String] The link name.
@return [Receiver, nil] The receiver, or nil if an error occurred.
# File lib/core/session.rb, line 147 def receiver(name) Receiver.new(Cproton.pn_receiver(@impl, name)) end
Constructs a new sender.
Each sender between two AMQP containers must be uniquely named. Note that this uniqueness cannot be enforced at the library level, so some consideration should be taken in choosing link names.
@param name [String] The link name.
@return [Sender, nil] The sender, or nil if an error occurred.
# File lib/core/session.rb, line 133 def sender(name) Sender.new(Cproton.pn_sender(@impl, name)) end