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

new(impl) click to toggle source

@private

# File lib/core/session.rb, line 75
def initialize(impl)
  @impl = impl
  self.class.store_instance(self, :pn_session_attachments)
end
wrap(impl) click to toggle source

@private

# File lib/core/session.rb, line 69
def self.wrap(impl)
  return nil if impl.nil?
  self.fetch_instance(impl, :pn_session_attachments) || Session.new(impl)
end

Public Instance Methods

close(error=nil) click to toggle source

Close the local end of the session. The remote end may or may not be closed. @param error [Condition] Optional error condition to send with the close.

# File lib/core/session.rb, line 82
def close(error=nil)
  Condition.assign(_local_condition, error)
  Cproton.pn_session_close(@impl)
end
connection() click to toggle source

Returns the parent connection.

@return [Connection] The connection.

# File lib/core/session.rb, line 97
def connection
  Connection.wrap(Cproton.pn_session_connection(@impl))
end
each_receiver() click to toggle source

Get the {Receiver} links - see {#each_link}

# File lib/core/session.rb, line 147
def each_receiver() each_link.select { |l| l.receiver? }; end
each_sender() click to toggle source

Get the {Sender} links - see {#each_link}

# File lib/core/session.rb, line 144
def each_sender() each_link.select { |l| l.sender? }; end
next(state_mask) click to toggle source

@deprecated use {Connection#each_session}

# File lib/core/session.rb, line 88
def next(state_mask)
  deprecated __method__, "Connection#each_session"
  Session.wrap(Cproton.pn_session_next(@impl, state_mask))
end
open_receiver(opts=nil) click to toggle source

Create and open a {Receiver} link, see {Receiver#open} @param opts [Hash] receiver options, see {Receiver#open} @return [Receiver]

# File lib/core/session.rb, line 116
def open_receiver(opts=nil) 
  Receiver.new(Cproton.pn_receiver(@impl, link_name(opts))).open(opts)
end
open_sender(opts=nil) click to toggle source

Create and open a {Sender} link, see {#open} @param opts [Hash] sender options, see {Sender#open} @return [Sender]

# File lib/core/session.rb, line 123
def open_sender(opts=nil)
  Sender.new(Cproton.pn_sender(@impl, link_name(opts))).open(opts)
end
receiver(name) click to toggle source

@deprecated use {#open_receiver}

# File lib/core/session.rb, line 108
def receiver(name)
  deprecated __method__, "open_receiver"
  Receiver.new(Cproton.pn_receiver(@impl, name))
end
sender(name) click to toggle source

@deprecated use {#open_sender}

# File lib/core/session.rb, line 102
def sender(name)
  deprecated __method__, "open_sender"
  Sender.new(Cproton.pn_sender(@impl, name));
end

Private Instance Methods

_local_condition() click to toggle source
# File lib/core/session.rb, line 155
def _local_condition
  Cproton.pn_session_condition(@impl)
end