Class: Qpid::Proton::Session

Inherits:
Endpoint show all
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

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

Instance Method Summary collapse

Methods inherited from Endpoint

#check_state, #handler, #handler=, #local_active?, #local_closed?, #local_uninit?, #remote_active?, #remote_closed?, #remote_uninit?, #transport

Instance Attribute Details

#incoming_bytesFixnum (readonly)

Returns The number of incomign bytes currently being buffered.

Returns:

  • (Fixnum)

    The number of incomign bytes currently being buffered.



61
# File 'lib/core/session.rb', line 61

proton_caller :incoming_bytes

#incoming_capacityFixnum

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.

Returns:

  • (Fixnum)

    The incoing capacity of the session, measured in bytes.



46
# File 'lib/core/session.rb', line 46

proton_accessor :incoming_capacity

#outgoing_bytesFixnum (readonly)

Returns The number of outgoing bytes currently being buffered.

Returns:

  • (Fixnum)

    The number of outgoing bytes currently being buffered.



55
# File 'lib/core/session.rb', line 55

proton_caller :outgoing_bytes

#stateFixnum (readonly)

Returns The endpoint state.

Returns:

  • (Fixnum)

    The endpoint state.



76
# File 'lib/core/session.rb', line 76

proton_caller :state

Instance Method Details

#closeObject

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.



96
97
98
99
# File 'lib/core/session.rb', line 96

def close
  self._update_condition
  Cproton.pn_session_close(@impl)
end

#connectionConnection

Returns the parent connection.

Returns:



119
120
121
# File 'lib/core/session.rb', line 119

def connection
  Connection.wrap(Cproton.pn_session_connection(@impl))
end

#next(state_mask) ⇒ Session?

Retrieves the next session from a given connection that matches the specified state mask.

When uses with Connection#session_head an application can access all of the session son the connection that match the given state.

Parameters:

  • state_mask (Fixnum)

    The state mask to match.

Returns:

  • (Session, nil)

    The next session if one matches, or nil.



111
112
113
# File 'lib/core/session.rb', line 111

def next(state_mask)
  Session.wrap(Cproton.pn_session_next(@impl, state_mask))
end

#openObject

Opens the session.

Once this operaton has completed, the state flag is updated.



70
# File 'lib/core/session.rb', line 70

proton_caller :open

#receiver(name) ⇒ Receiver?

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.

Parameters:

  • name (String)

    The link name.

Returns:

  • (Receiver, nil)

    The receiver, or nil if an error occurred.



147
148
149
# File 'lib/core/session.rb', line 147

def receiver(name)
  Receiver.new(Cproton.pn_receiver(@impl, name))
end

#sender(name) ⇒ Sender?

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.

Parameters:

  • name (String)

    The link name.

Returns:

  • (Sender, nil)

    The sender, or nil if an error occurred.



133
134
135
# File 'lib/core/session.rb', line 133

def sender(name)
  Sender.new(Cproton.pn_sender(@impl, name))
end