Class AmqpWireFormat
- java.lang.Object
-
- org.apache.activemq.transport.amqp.AmqpWireFormat
-
- All Implemented Interfaces:
WireFormat
public class AmqpWireFormat extends Object implements WireFormat
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
AmqpWireFormat.ResetListener
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_ALLOW_NON_SASL_CONNECTIONS
static int
DEFAULT_ANQP_FRAME_SIZE
static int
DEFAULT_CONNECTION_TIMEOUT
static int
DEFAULT_IDLE_TIMEOUT
static long
DEFAULT_MAX_FRAME_SIZE
static int
DEFAULT_PRODUCER_CREDIT
static int
NO_AMQP_MAX_FRAME_SIZE
-
Constructor Summary
Constructors Constructor Description AmqpWireFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getConnectAttemptTimeout()
int
getIdleTimeout()
int
getMaxAmqpFrameSize()
long
getMaxFrameSize()
AmqpHeader
getMinimallySupportedHeader()
Returns an AMQP Header object that represents the minimally protocol versions supported by this transport.int
getProducerCredit()
String
getTransformer()
int
getVersion()
boolean
isAllowNonSaslConnections()
boolean
isHeaderValid(AmqpHeader header, boolean authenticated)
Given an AMQP header validate that the AMQP magic is present and if so that the version and protocol values align with what we support.boolean
isMagicRead()
ByteSequence
marshal(Object command)
Packet based marshalingvoid
marshal(Object command, DataOutput dataOut)
Stream based marshalingvoid
resetMagicRead()
void
setAllowNonSaslConnections(boolean allowNonSaslConnections)
void
setConnectAttemptTimeout(int connectAttemptTimeout)
void
setIdleTimeout(int idelTimeout)
void
setMaxAmqpFrameSize(int maxAmqpFrameSize)
void
setMaxFrameSize(long maxFrameSize)
void
setProducerCredit(int producerCredit)
void
setProtocolResetListener(AmqpWireFormat.ResetListener listener)
void
setTransformer(String transformer)
void
setVersion(int version)
Object
unmarshal(DataInput dataIn)
Packet based un-marshalingObject
unmarshal(ByteSequence packet)
Packet based un-marshaling
-
-
-
Field Detail
-
DEFAULT_MAX_FRAME_SIZE
public static final long DEFAULT_MAX_FRAME_SIZE
- See Also:
- Constant Field Values
-
NO_AMQP_MAX_FRAME_SIZE
public static final int NO_AMQP_MAX_FRAME_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_CONNECTION_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_IDLE_TIMEOUT
public static final int DEFAULT_IDLE_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_PRODUCER_CREDIT
public static final int DEFAULT_PRODUCER_CREDIT
- See Also:
- Constant Field Values
-
DEFAULT_ALLOW_NON_SASL_CONNECTIONS
public static final boolean DEFAULT_ALLOW_NON_SASL_CONNECTIONS
- See Also:
- Constant Field Values
-
DEFAULT_ANQP_FRAME_SIZE
public static final int DEFAULT_ANQP_FRAME_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
marshal
public ByteSequence marshal(Object command) throws IOException
Description copied from interface:WireFormat
Packet based marshaling- Specified by:
marshal
in interfaceWireFormat
- Throws:
IOException
-
unmarshal
public Object unmarshal(ByteSequence packet) throws IOException
Description copied from interface:WireFormat
Packet based un-marshaling- Specified by:
unmarshal
in interfaceWireFormat
- Throws:
IOException
-
marshal
public void marshal(Object command, DataOutput dataOut) throws IOException
Description copied from interface:WireFormat
Stream based marshaling- Specified by:
marshal
in interfaceWireFormat
- Throws:
IOException
-
unmarshal
public Object unmarshal(DataInput dataIn) throws IOException
Description copied from interface:WireFormat
Packet based un-marshaling- Specified by:
unmarshal
in interfaceWireFormat
- Throws:
IOException
-
isHeaderValid
public boolean isHeaderValid(AmqpHeader header, boolean authenticated)
Given an AMQP header validate that the AMQP magic is present and if so that the version and protocol values align with what we support. In the case where authentication occurs the client sends us two AMQP headers, the first being the SASL initial header which triggers the authentication process and then if that succeeds we should get a second AMQP header that does not contain the SASL protocol ID indicating the connection process should follow the normal path. We validate that the header align with these expectations.- Parameters:
header
- the header instance received from the client.authenticated
- has the client already authenticated already.- Returns:
- true if the header is valid against the current WireFormat.
-
getMinimallySupportedHeader
public AmqpHeader getMinimallySupportedHeader()
Returns an AMQP Header object that represents the minimally protocol versions supported by this transport. A client that attempts to connect with an AMQP version that doesn't at least meat this value will receive this prior to the connection being closed.- Returns:
- the minimal AMQP version needed from the client.
-
setVersion
public void setVersion(int version)
- Specified by:
setVersion
in interfaceWireFormat
- Parameters:
version
- the version of the wire format
-
getVersion
public int getVersion()
- Specified by:
getVersion
in interfaceWireFormat
- Returns:
- the version of the wire format
-
resetMagicRead
public void resetMagicRead()
-
setProtocolResetListener
public void setProtocolResetListener(AmqpWireFormat.ResetListener listener)
-
isMagicRead
public boolean isMagicRead()
-
getMaxFrameSize
public long getMaxFrameSize()
-
setMaxFrameSize
public void setMaxFrameSize(long maxFrameSize)
-
getMaxAmqpFrameSize
public int getMaxAmqpFrameSize()
-
setMaxAmqpFrameSize
public void setMaxAmqpFrameSize(int maxAmqpFrameSize)
-
isAllowNonSaslConnections
public boolean isAllowNonSaslConnections()
-
setAllowNonSaslConnections
public void setAllowNonSaslConnections(boolean allowNonSaslConnections)
-
getConnectAttemptTimeout
public int getConnectAttemptTimeout()
-
setConnectAttemptTimeout
public void setConnectAttemptTimeout(int connectAttemptTimeout)
-
setProducerCredit
public void setProducerCredit(int producerCredit)
-
getProducerCredit
public int getProducerCredit()
-
getTransformer
public String getTransformer()
-
setTransformer
public void setTransformer(String transformer)
-
getIdleTimeout
public int getIdleTimeout()
-
setIdleTimeout
public void setIdleTimeout(int idelTimeout)
-
-