org.apache.qpid.server.protocol
Interface AMQProtocolSession

All Known Implementing Classes:
AMQMinaProtocolSession

public interface AMQProtocolSession


Method Summary
 void addChannel(AMQChannel channel)
          Associate a channel with this session.
 void closeChannel(int channelId)
          Close a specific channel.
 void closeSession()
          This must be called when the session is _closed in order to free up any resources managed by the session.
 void dataBlockReceived(org.apache.qpid.framing.AMQDataBlock message)
          Called when a protocol data block is received
 AMQChannel getChannel(int channelId)
          Get the channel for this session associated with the specified id.
 java.lang.String getContextKey()
          Get the context key associated with this session.
 java.lang.Object getKey()
           
 java.lang.String getLocalFQDN()
          Get the fully qualified domain name of the local address to which this session is bound.
 javax.security.sasl.SaslServer getSaslServer()
           
 void initHeartbeats(int delay)
          Initialise heartbeats on the session.
 void removeChannel(int channelId)
          Remove a channel from the session but do not close it.
 void setContextKey(java.lang.String contextKey)
          Set the context key associated with this session.
 void setSaslServer(javax.security.sasl.SaslServer saslServer)
          Set the sasl server that is to perform authentication for this session.
 void writeFrame(org.apache.qpid.framing.AMQDataBlock frame)
          Write a datablock, encoding where necessary (e.g.
 

Method Detail

dataBlockReceived

void dataBlockReceived(org.apache.qpid.framing.AMQDataBlock message)
                       throws java.lang.Exception
Called when a protocol data block is received

Parameters:
message - the data block that has been received
Throws:
java.lang.Exception - if processing the datablock fails

writeFrame

void writeFrame(org.apache.qpid.framing.AMQDataBlock frame)
Write a datablock, encoding where necessary (e.g. into a sequence of bytes)

Parameters:
frame - the frame to be encoded and written

getContextKey

java.lang.String getContextKey()
Get the context key associated with this session. Context key is described in the AMQ protocol specification (RFC 6).

Returns:
the context key

setContextKey

void setContextKey(java.lang.String contextKey)
Set the context key associated with this session. Context key is described in the AMQ protocol specification (RFC 6).

Parameters:
contextKey - the context key

getChannel

AMQChannel getChannel(int channelId)
                      throws org.apache.qpid.AMQException
Get the channel for this session associated with the specified id. A channel id is unique per connection (i.e. per session).

Parameters:
channelId - the channel id which must be valid
Returns:
null if no channel exists, the channel otherwise
Throws:
org.apache.qpid.AMQException

addChannel

void addChannel(AMQChannel channel)
Associate a channel with this session.

Parameters:
channel - the channel to associate with this session. It is an error to associate the same channel with more than one session but this is not validated.

closeChannel

void closeChannel(int channelId)
                  throws org.apache.qpid.AMQException
Close a specific channel. This will remove any resources used by the channel, including:

Parameters:
channelId - id of the channel to close
Throws:
org.apache.qpid.AMQException - if an error occurs closing the channel
java.lang.IllegalArgumentException - if the channel id is not valid

removeChannel

void removeChannel(int channelId)
Remove a channel from the session but do not close it.

Parameters:
channelId -

initHeartbeats

void initHeartbeats(int delay)
Initialise heartbeats on the session.

Parameters:
delay - delay in seconds (not ms)

closeSession

void closeSession()
                  throws org.apache.qpid.AMQException
This must be called when the session is _closed in order to free up any resources managed by the session.

Throws:
org.apache.qpid.AMQException

getKey

java.lang.Object getKey()
Returns:
a key that uniquely identifies this session

getLocalFQDN

java.lang.String getLocalFQDN()
Get the fully qualified domain name of the local address to which this session is bound. Since some servers may be bound to multiple addresses this could vary depending on the acceptor this session was created from.

Returns:
a String FQDN

getSaslServer

javax.security.sasl.SaslServer getSaslServer()
Returns:
the sasl server that can perform authentication for this session.

setSaslServer

void setSaslServer(javax.security.sasl.SaslServer saslServer)
Set the sasl server that is to perform authentication for this session.

Parameters:
saslServer -