public interface Transport extends Endpoint
Operates on the entities in the associated Connection
by accepting and producing binary AMQP output, potentially
layered within SASL and/or SSL.
After a connection is bound with bind(Connection)
, the methods for accepting and producing
output are typically repeatedly called. See the specific methods for details of their legal usage.
Processing the input data received from another AMQP container.
getInputBuffer()
processInput()
TransportResult.checkIsOk()
Getting the output data to send to another AMQP container:
getOutputBuffer()
outputConsumed()
The following methods on the byte buffers returned by getInputBuffer()
and getOutputBuffer()
must not be called:
Modifier and Type | Interface and Description |
---|---|
static class |
Transport.Factory |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_FRAME_SIZE |
static int |
END_OF_STREAM |
static int |
MIN_MAX_FRAME_SIZE
the lower bound for the agreed maximum frame size (in bytes).
|
static int |
SESSION_WINDOW |
static int |
TRACE_DRV |
static int |
TRACE_FRM |
static int |
TRACE_OFF |
static int |
TRACE_RAW |
Modifier and Type | Method and Description |
---|---|
void |
bind(Connection connection) |
int |
capacity() |
void |
close_head() |
void |
close_tail() |
int |
getChannelMax()
Gets the local channel-max value to be advertised to the remote peer
|
ErrorCondition |
getCondition() |
long |
getFramesInput() |
long |
getFramesOutput() |
int |
getIdleTimeout() |
ByteBuffer |
getInputBuffer()
Get a buffer that can be used to write input data into the transport.
|
int |
getMaxFrameSize()
Get the maximum frame size for the transport
|
ByteBuffer |
getOutputBuffer()
Get a read-only byte buffer containing the transport's pending output.
|
int |
getRemoteChannelMax()
Gets the remote value of channel-max, as advertised by the peer on its
Open frame.
|
int |
getRemoteIdleTimeout() |
int |
getRemoteMaxFrameSize() |
ByteBuffer |
head() |
int |
input(byte[] bytes,
int offset,
int size)
Deprecated.
use
getInputBuffer() and processInput() instead. |
boolean |
isClosed() |
boolean |
isEmitFlowEventOnSend() |
int |
output(byte[] dest,
int offset,
int size)
Deprecated.
use
getOutputBuffer() and outputConsumed() instead |
void |
outputConsumed()
Informs the transport that the output buffer returned by
getOutputBuffer()
is finished with, allowing implementation-dependent steps to be performed such as
reclaiming buffer space. |
int |
pending() |
void |
pop(int bytes) |
void |
process() |
TransportResult |
processInput()
Tell the transport to process the data written to the input buffer.
|
Sasl |
sasl()
Signal the transport to expect SASL frames used to establish a SASL layer prior to
performing the AMQP protocol version negotiation.
|
void |
setChannelMax(int channelMax)
Set the local value of channel-max, to be advertised to the peer on the
Open frame emitted by the transport.
|
void |
setEmitFlowEventOnSend(boolean emitFlowEventOnSend)
Configure whether a synthetic Flow event should be emitted when messages are sent,
reflecting a change in the credit level on the link that may prompt other action.
|
void |
setIdleTimeout(int timeout) |
void |
setMaxFrameSize(int size) |
Ssl |
ssl(SslDomain sslDomain)
As per
ssl(SslDomain, SslPeerDetails) but no attempt is made to resume a previous SSL session. |
Ssl |
ssl(SslDomain sslDomain,
SslPeerDetails sslPeerDetails)
Wrap this transport's output and input to apply SSL encryption and decryption respectively.
|
ByteBuffer |
tail() |
long |
tick(long now) |
void |
trace(int levels) |
void |
unbind() |
close, free, getContext, getLocalState, getRemoteCondition, getRemoteState, open, setCondition, setContext
attachments
static final int TRACE_OFF
static final int TRACE_RAW
static final int TRACE_FRM
static final int TRACE_DRV
static final int DEFAULT_MAX_FRAME_SIZE
static final int MIN_MAX_FRAME_SIZE
static final int SESSION_WINDOW
static final int END_OF_STREAM
void trace(int levels)
void bind(Connection connection)
void unbind()
int capacity()
ByteBuffer tail()
void process() throws TransportException
TransportException
void close_tail()
int pending()
ByteBuffer head()
void pop(int bytes)
void close_head()
boolean isClosed()
@Deprecated int input(byte[] bytes, int offset, int size)
getInputBuffer()
and processInput()
instead.bytes
- input bytes for consumptionoffset
- the offset within bytes where input beginssize
- the number of bytes available for inputTransportException
- if the input is invalid, if the transport is already in an error state,
or if the input is empty (unless the remote connection is already closed)ByteBuffer getInputBuffer()
processInput()
must be called.
Successive calls to this method are not guaranteed to return the same object.
Once processInput()
is called the buffer must not be used.TransportException
- if the transport is already in an invalid stateTransportResult processInput()
processInput()
calls on this object will
throw an exception.getInputBuffer()
@Deprecated int output(byte[] dest, int offset, int size)
getOutputBuffer()
and outputConsumed()
insteaddest
- array for output bytesoffset
- the offset within bytes where output beginssize
- the maximum number of bytes to be outputByteBuffer getOutputBuffer()
outputConsumed()
must be called.
Successive calls to this method are not guaranteed to return the same object.
Once outputConsumed()
is called the buffer must not be used.
If the transport's state changes AFTER calling this method, this will not be
reflected in the output buffer.void outputConsumed()
getOutputBuffer()
is finished with, allowing implementation-dependent steps to be performed such as
reclaiming buffer space.Sasl sasl() throws IllegalStateException
Sasl
object.IllegalStateException
- if transport processing has already begun prior to initial invocationSsl ssl(SslDomain sslDomain, SslPeerDetails sslPeerDetails)
Ssl
object, regardless of the parameters supplied.sslDomain
- the SSL settings to usesslPeerDetails
- may be null, in which case SSL session resume will not be attemptedSsl
object representing the SSL session.Ssl ssl(SslDomain sslDomain)
ssl(SslDomain, SslPeerDetails)
but no attempt is made to resume a previous SSL session.int getMaxFrameSize()
void setMaxFrameSize(int size)
int getRemoteMaxFrameSize()
int getChannelMax()
setChannelMax(int)
void setChannelMax(int channelMax)
getRemoteChannelMax()
.channelMax
- the local channel-max to advertise to the peer, in range [0 - 2^16).IllegalArgumentException
- if the value supplied is outside range [0 - 2^16).int getRemoteChannelMax()
getChannelMax()
.ErrorCondition getCondition()
getCondition
in interface Endpoint
void setIdleTimeout(int timeout)
timeout
- local idle timeout in millisecondsint getIdleTimeout()
int getRemoteIdleTimeout()
long tick(long now)
long getFramesInput()
long getFramesOutput()
void setEmitFlowEventOnSend(boolean emitFlowEventOnSend)
emitFlowEventOnSend
- true if a flow event should be emitted, false otherwiseboolean isEmitFlowEventOnSend()
Copyright © 2016 The Apache Software Foundation. All rights reserved.