Class: Qpid::Proton::Session
- Includes:
- Util::Deprecation, Util::Wrapper
- Defined in:
- lib/core/session.rb
Overview
A session is the parent for senders and receivers.
A Session has a single parent Qpid::Proton::Connection instance.
Constant Summary collapse
- PROTON_METHOD_PREFIX =
"pn_session"
Constants included from Util::Deprecation
Util::Deprecation::DEPRECATE_FULL_TRACE, Util::Deprecation::MATCH_DIR
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 Attribute Summary collapse
-
#incoming_bytes ⇒ Integer
readonly
The number of incomign bytes currently being buffered.
-
#incoming_capacity ⇒ Integer
The incoming capacity of a session determines how much incoming message data the session will buffer.
-
#outgoing_bytes ⇒ Integer
readonly
The number of outgoing bytes currently being buffered.
-
#state ⇒ Integer
readonly
The endpoint state.
Attributes included from Util::Wrapper
Class Method Summary collapse
Instance Method Summary collapse
-
#close(error = nil) ⇒ Object
Close the local end of the session.
-
#connection ⇒ Connection
Returns the parent connection.
-
#each_link ⇒ Object
Get the links on this Session.
-
#each_receiver ⇒ Object
Get the Receiver links - see #each_link.
-
#each_sender ⇒ Object
Get the Sender links - see #each_link.
-
#initialize(impl) ⇒ Session
constructor
A new instance of Session.
- #next(state_mask) ⇒ Object 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) ⇒ Object
deprecated
Deprecated.
use #open_receiver
-
#sender(name) ⇒ Object
deprecated
Deprecated.
use #open_sender
Methods included from Util::Wrapper
included, #inspect, registry, #to_s
Methods included from Util::Deprecation
deprecated, #deprecated, included
Methods inherited from Endpoint
#check_state, #closed?, #condition, #local_closed?, #local_condition, #local_open?, #local_uninit?, #open?, #remote_closed?, #remote_condition, #remote_open?, #remote_uninit?, #transport, #work_queue
Constructor Details
#initialize(impl) ⇒ Session
Returns a new instance of Session.
75 76 77 78 |
# File 'lib/core/session.rb', line 75 def initialize(impl) @impl = impl self.class.store_instance(self, :pn_session_attachments) end |
Instance Attribute Details
#incoming_bytes ⇒ Integer (readonly)
Returns The number of incomign bytes currently being buffered.
57 |
# File 'lib/core/session.rb', line 57 proton_caller :incoming_bytes |
#incoming_capacity ⇒ Integer
The incoming capacity of a session determines how much incoming message data the session will buffer. Note that if this value is less than the negotatied frame size of the transport, it will be rounded up to one full frame.
42 |
# File 'lib/core/session.rb', line 42 proton_set_get :incoming_capacity |
#outgoing_bytes ⇒ Integer (readonly)
Returns The number of outgoing bytes currently being buffered.
51 |
# File 'lib/core/session.rb', line 51 proton_caller :outgoing_bytes |
#state ⇒ Integer (readonly)
Returns The endpoint state.
66 |
# File 'lib/core/session.rb', line 66 proton_caller :state |
Class Method Details
Instance Method Details
#close(error = nil) ⇒ Object
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| ... } ⇒ Object #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 ⇒ Object
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 ⇒ Object
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) ⇒ Object
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) ⇒ Object
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) ⇒ Object
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 |