Package org.apache.qpid.protonj2.engine
Interface Session
- 
- All Known Implementing Classes:
- ProtonSession
 
 public interface Session extends Endpoint<Session> AMQP Session interface
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description TransactionControllercoordinator(java.lang.String name)Create a newTransactionControllerusing the provided name.SessiondeliveryReadHandler(EventHandler<IncomingDelivery> delivery)Allows monitoring of incoming deliveries to receivers attached to thisSession.ConnectiongetConnection()longgetHandleMax()intgetIncomingCapacity()intgetOutgoingCapacity()ConnectiongetParent()Gets the parent of thisEndpointwhich can be itself forConnectioninstance.intgetRemainingIncomingCapacity()intgetRemainingOutgoingCapacity()SessionStategetRemoteState()SessionStategetState()java.util.Set<Link<?>>links()Receiverreceiver(java.lang.String name)Create a newReceiverlink using the provided nameSessionreceiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler)Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a receiving link.java.util.Set<? extends Receiver>receivers()Sendersender(java.lang.String name)Create a newSenderlink using the provided name.SessionsenderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler)Sets aEventHandlerfor when an AMQP Attach frame is received from the remote peer for a sending link.java.util.Set<? extends Sender>senders()SessionsetHandleMax(long handleMax)Set the handle max value for this Session.SessionsetIncomingCapacity(int incomingCapacity)Sets the maximum number of bytes this session can be sent from the remote.SessionsetOutgoingCapacity(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.SessiontransactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler)Sets aEventHandlerfor 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.Endpointclose, 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- 
getStateSessionState getState() - Returns:
- the local session state
 
 - 
getConnectionConnection getConnection() - Returns:
- the parent Connectionfor this Session.
 
 - 
getParentConnection getParent() Description copied from interface:EndpointGets the parent of thisEndpointwhich can be itself forConnectioninstance.- Specified by:
- getParentin interface- Endpoint<Session>
- Returns:
- the parent Connectionof theLink
 
 - 
linksjava.util.Set<Link<?>> links() - Returns:
- a set of Sender and Receiver instances tracked by this session.
 
 - 
sendersjava.util.Set<? extends Sender> senders() - Returns:
- a set of Sender instances tracked by this session.
 
 - 
receiversjava.util.Set<? extends Receiver> receivers() - Returns:
- a set of Receiver instances tracked by this session.
 
 - 
senderSender sender(java.lang.String name) throws java.lang.IllegalStateException Create a newSenderlink using the provided name.
 - 
receiverReceiver receiver(java.lang.String name) throws java.lang.IllegalStateException Create a newReceiverlink using the provided name
 - 
coordinatorTransactionController coordinator(java.lang.String name) throws java.lang.IllegalStateException Create a newTransactionControllerusing the provided name.- Parameters:
- name- The name to assign to the created- TransactionController
- Returns:
- a newly created TransactionControllerinstance.
- Throws:
- java.lang.IllegalStateException- if the- Sessionhas already been closed.
 
 - 
setIncomingCapacitySession setIncomingCapacity(int incomingCapacity) throws java.lang.IllegalStateException Sets the maximum number of bytes this session can be sent from the remote.
 - 
getIncomingCapacityint getIncomingCapacity() - Returns:
- the current incoming capacity of this session.
 
 - 
getRemainingIncomingCapacityint getRemainingIncomingCapacity() - Returns:
- the remaining session capacity based on how many bytes are currently pending,
 
 - 
setOutgoingCapacitySession 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.
 - 
getOutgoingCapacityint getOutgoingCapacity() - Returns:
- the current outgoing capacity limit of this session.
 
 - 
getRemainingOutgoingCapacityint getRemainingOutgoingCapacity() - Returns:
- the remaining session outgoing capacity based on how many bytes are currently pending,
 
 - 
setHandleMaxSession 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 Sessioninstance.
- Throws:
- java.lang.IllegalStateException- if the Session has already been opened.
 
 - 
getHandleMaxlong getHandleMax() - Returns:
- the currently configured handle max for this Session
 
 - 
getRemoteStateSessionState getRemoteState() - Returns:
- the remote session state (as last communicated)
 
 - 
senderOpenHandlerSession senderOpenHandler(EventHandler<Sender> remoteSenderOpenEventHandler) Sets aEventHandlerfor 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
 
 - 
receiverOpenHandlerSession receiverOpenHandler(EventHandler<Receiver> remoteReceiverOpenEventHandler) Sets aEventHandlerfor 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
 
 - 
transactionManagerOpenHandlerSession transactionManagerOpenHandler(EventHandler<TransactionManager> remoteTxnManagerOpenEventHandler) Sets aEventHandlerfor 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 remoteTransactionControllercreation. If an event handler for remoteTransactionControlleropen is registered on this Session for aTransactionControllerscoped to it then this handler will be invoked instead of the variant in theConnectionAPI.- Parameters:
- remoteTxnManagerOpenEventHandler- the EventHandler that will be signaled when a- TransactionControllerlink is remotely opened.
- Returns:
- this Session for chaining
 
 - 
deliveryReadHandlerSession deliveryReadHandler(EventHandler<IncomingDelivery> delivery) Allows monitoring of incoming deliveries to receivers attached to thisSession. TheReceiverthat is the target of the incoming delivery will be notified first of the incoming delivery and any processing should be done using theReceiver.deliveryReadHandler(EventHandler). This event point will be trigger only after theReceiverlevel handler and should be used to monitor deliveries passing through a session for logging or other state related actions performed by the service managing this session.- Parameters:
- delivery- The delivery that was read which contains
- Returns:
- this Session for chaining
 
 
- 
 
-