Package org.apache.qpid.protonj2.engine
Interface Session
-
- All Known Implementing Classes:
ProtonSession
public interface Session extends Endpoint<Session>
AMQP Session interface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TransactionController
coordinator(java.lang.String name)
Create a newTransactionController
using the provided name.Connection
getConnection()
long
getHandleMax()
int
getIncomingCapacity()
int
getOutgoingCapacity()
Connection
getParent()
Gets the parent of thisEndpoint
which can be itself forConnection
instance.int
getRemainingIncomingCapacity()
int
getRemainingOutgoingCapacity()
SessionState
getRemoteState()
SessionState
getState()
java.util.Set<Link<?>>
links()
Receiver
receiver(java.lang.String name)
Create a newReceiver
link using the provided nameSession
receiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler)
Sets aEventHandler
for when an AMQP Attach frame is received from the remote peer for a receiving link.java.util.Set<? extends Receiver>
receivers()
Sender
sender(java.lang.String name)
Create a newSender
link using the provided name.Session
senderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler)
Sets aEventHandler
for when an AMQP Attach frame is received from the remote peer for a sending link.java.util.Set<? extends Sender>
senders()
Session
setHandleMax(long handleMax)
Set the handle max value for this Session.Session
setIncomingCapacity(int incomingCapacity)
Sets the maximum number of bytes this session can be sent from the remote.Session
setOutgoingCapacity(int outgoingCapacity)
Sets the maximum number of bytes this session can be write before blocking additional sends until the written bytes are known to have been flushed to the write.Session
transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler)
Sets aEventHandler
for when an AMQP Attach frame is received from the remote peer for a transaction coordination link.-
Methods inherited from interface org.apache.qpid.protonj2.engine.Endpoint
close, closeHandler, engineShutdownHandler, getAttachments, getCondition, getDesiredCapabilities, getEngine, getLinkedResource, getLinkedResource, getOfferedCapabilities, getProperties, getRemoteCondition, getRemoteDesiredCapabilities, getRemoteOfferedCapabilities, getRemoteProperties, isLocallyClosed, isLocallyOpen, isRemotelyClosed, isRemotelyOpen, localCloseHandler, localOpenHandler, open, openHandler, setCondition, setDesiredCapabilities, setLinkedResource, setOfferedCapabilities, setProperties
-
-
-
-
Method Detail
-
getState
SessionState getState()
- Returns:
- the local session state
-
getConnection
Connection getConnection()
- Returns:
- the parent
Connection
for this Session.
-
getParent
Connection getParent()
Description copied from interface:Endpoint
Gets the parent of thisEndpoint
which can be itself forConnection
instance.- Specified by:
getParent
in interfaceEndpoint<Session>
- Returns:
- the parent
Connection
of theLink
-
links
java.util.Set<Link<?>> links()
- Returns:
- a set of Sender and Receiver instances tracked by this session.
-
senders
java.util.Set<? extends Sender> senders()
- Returns:
- a set of Sender instances tracked by this session.
-
receivers
java.util.Set<? extends Receiver> receivers()
- Returns:
- a set of Receiver instances tracked by this session.
-
sender
Sender sender(java.lang.String name) throws java.lang.IllegalStateException
Create a newSender
link using the provided name.
-
receiver
Receiver receiver(java.lang.String name) throws java.lang.IllegalStateException
Create a newReceiver
link using the provided name
-
coordinator
TransactionController coordinator(java.lang.String name) throws java.lang.IllegalStateException
Create a newTransactionController
using the provided name.- Parameters:
name
- The name to assign to the createdTransactionController
- Returns:
- a newly created
TransactionController
instance. - Throws:
java.lang.IllegalStateException
- if theSession
has already been closed.
-
setIncomingCapacity
Session setIncomingCapacity(int incomingCapacity) throws java.lang.IllegalStateException
Sets the maximum number of bytes this session can be sent from the remote.
-
getIncomingCapacity
int getIncomingCapacity()
- Returns:
- the current incoming capacity of this session.
-
getRemainingIncomingCapacity
int getRemainingIncomingCapacity()
- Returns:
- the remaining session capacity based on how many bytes are currently pending,
-
setOutgoingCapacity
Session setOutgoingCapacity(int outgoingCapacity) throws java.lang.IllegalStateException
Sets the maximum number of bytes this session can be write before blocking additional sends until the written bytes are known to have been flushed to the write. This limit is intended to deal with issues of memory allocation when the I/O layer allows for asynchronous writes and finer grained control over the pending write buffers is needed.
-
getOutgoingCapacity
int getOutgoingCapacity()
- Returns:
- the current outgoing capacity limit of this session.
-
getRemainingOutgoingCapacity
int getRemainingOutgoingCapacity()
- Returns:
- the remaining session outgoing capacity based on how many bytes are currently pending,
-
setHandleMax
Session setHandleMax(long handleMax) throws java.lang.IllegalStateException
Set the handle max value for this Session. The handle max value can only be modified prior to a call toEndpoint.open()
, once the session has been opened locally an error will be thrown if this method is called.- Parameters:
handleMax
- The value to set for handle max when opening the session.- Returns:
- this
Session
instance. - Throws:
java.lang.IllegalStateException
- if the Session has already been opened.
-
getHandleMax
long getHandleMax()
- Returns:
- the currently configured handle max for this
Session
-
getRemoteState
SessionState getRemoteState()
- Returns:
- the remote session state (as last communicated)
-
senderOpenHandler
Session senderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler)
Sets aEventHandler
for when an AMQP Attach frame is received from the remote peer for a sending link. Used to process remotely initiated sending link. Locally initiated links have their own EventHandler invoked instead. This method is Typically used by servers to listen for remote Receiver creation. If an event handler for remote sender open is registered on this Session for a link scoped to it then this handler will be invoked instead of the variant in the Connection API.- Parameters:
remoteSenderOpenEventHandler
- the EventHandler that will be signaled when a sender link is remotely opened.- Returns:
- this session for chaining
-
receiverOpenHandler
Session receiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler)
Sets aEventHandler
for when an AMQP Attach frame is received from the remote peer for a receiving link. Used to process remotely initiated receiving link. Locally initiated links have their own EventHandler invoked instead. This method is Typically used by servers to listen for remote Sender creation. If an event handler for remote sender open is registered on this Session for a link scoped to it then this handler will be invoked instead of the variant in the Connection API.- Parameters:
remoteReceiverOpenEventHandler
- the EventHandler that will be signaled when a receiver link is remotely opened.- Returns:
- this session for chaining
-
transactionManagerOpenHandler
Session transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler)
Sets aEventHandler
for when an AMQP Attach frame is received from the remote peer for a transaction coordination link. Used to process remotely initiated transaction manager link. Locally initiated links have their own EventHandler invoked instead. This method is Typically used by servers to listen for remoteTransactionController
creation. If an event handler for remoteTransactionController
open is registered on this Session for aTransactionController
scoped to it then this handler will be invoked instead of the variant in theConnection
API.- Parameters:
remoteTxnManagerOpenEventHandler
- the EventHandler that will be signaled when aTransactionController
link is remotely opened.- Returns:
- this session for chaining
-
-