Class: Qpid::Proton::Session
Overview
A session is the parent for senders and receivers.
A Session has a single parent Qpid::Proton::Connection instance.
Constant Summary
Constants inherited from Endpoint
Endpoint::LOCAL_ACTIVE, Endpoint::LOCAL_CLOSED, Endpoint::LOCAL_MASK, Endpoint::LOCAL_UNINIT, Endpoint::REMOTE_ACTIVE, Endpoint::REMOTE_CLOSED, Endpoint::REMOTE_MASK, Endpoint::REMOTE_UNINIT
Instance Method Summary collapse
-
#close(error = nil)
Close the local end of the session.
-
#connection ⇒ Connection
Returns the parent connection.
-
#each_link
Get the links on this Session.
-
#each_receiver
Get the Receiver links - see #each_link.
-
#each_sender
Get the Sender links - see #each_link.
- #next(state_mask) deprecated Deprecated.
-
#open_receiver(opts = nil) ⇒ Receiver
Create and open a Receiver link, see Receiver#open.
-
#open_sender(opts = nil) ⇒ Sender
Create and open a Sender link, see #open.
-
#receiver(name)
deprecated
Deprecated.
use #open_receiver
-
#sender(name)
deprecated
Deprecated.
use #open_sender
Methods inherited from Endpoint
#closed?, #local_closed?, #local_open?, #local_uninit?, #open?, #remote_closed?, #remote_open?, #remote_uninit?, #transport, #work_queue
Instance Method Details
#close(error = nil)
Close the local end of the session. The remote end may or may not be closed.
82 83 84 85 |
# File 'lib/core/session.rb', line 82 def close(error=nil) Condition.assign(_local_condition, error) Cproton.pn_session_close(@impl) end |
#connection ⇒ Connection
Returns the parent connection.
97 98 99 |
# File 'lib/core/session.rb', line 97 def connection Connection.wrap(Cproton.pn_session_connection(@impl)) end |
#each_link {|l| ... } #each_link ⇒ Enumerator
Get the links on this Session.
132 133 134 135 136 137 138 139 140 141 |
# File 'lib/core/session.rb', line 132 def each_link return enum_for(:each_link) unless block_given? l = Cproton.pn_link_head(Cproton.pn_session_connection(@impl), 0); while l link = Link.wrap(l) yield link if link.session == self l = Cproton.pn_link_next(l, 0) end self end |
#each_receiver
Get the Receiver links - see #each_link
147 |
# File 'lib/core/session.rb', line 147 def each_receiver() each_link.select { |l| l.receiver? }; end |
#each_sender
Get the Qpid::Proton::Sender links - see #each_link
144 |
# File 'lib/core/session.rb', line 144 def each_sender() each_link.select { |l| l.sender? }; end |
#next(state_mask)
88 89 90 91 |
# 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) ⇒ Receiver
Create and open a Receiver link, see Receiver#open
116 117 118 |
# 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) ⇒ Sender
Create and open a Qpid::Proton::Sender link, see #open
123 124 125 |
# 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)
use #open_receiver
108 109 110 111 |
# File 'lib/core/session.rb', line 108 def receiver(name) deprecated __method__, "open_receiver" Receiver.new(Cproton.pn_receiver(@impl, name)) end |
#sender(name)
use #open_sender
102 103 104 105 |
# File 'lib/core/session.rb', line 102 def sender(name) deprecated __method__, "open_sender" Sender.new(Cproton.pn_sender(@impl, name)); end |