Class AmqpWireFormat
- java.lang.Object
-
- org.apache.activemq.transport.amqp.AmqpWireFormat
-
- All Implemented Interfaces:
org.apache.activemq.wireformat.WireFormat
public class AmqpWireFormat extends Object implements org.apache.activemq.wireformat.WireFormat
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceAmqpWireFormat.ResetListener
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ALLOW_NON_SASL_CONNECTIONSstatic intDEFAULT_ANQP_FRAME_SIZEstatic intDEFAULT_CONNECTION_TIMEOUTstatic intDEFAULT_IDLE_TIMEOUTstatic longDEFAULT_MAX_FRAME_SIZEstatic intDEFAULT_PRODUCER_CREDITstatic intNO_AMQP_MAX_FRAME_SIZE
-
Constructor Summary
Constructors Constructor Description AmqpWireFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetConnectAttemptTimeout()intgetIdleTimeout()intgetMaxAmqpFrameSize()longgetMaxFrameSize()AmqpHeadergetMinimallySupportedHeader()Returns an AMQP Header object that represents the minimally protocol versions supported by this transport.intgetProducerCredit()StringgetTransformer()intgetVersion()booleanisAllowNonSaslConnections()booleanisHeaderValid(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.booleanisMagicRead()ByteSequencemarshal(Object command)voidmarshal(Object command, DataOutput dataOut)voidresetMagicRead()voidsetAllowNonSaslConnections(boolean allowNonSaslConnections)voidsetConnectAttemptTimeout(int connectAttemptTimeout)voidsetIdleTimeout(int idelTimeout)voidsetMaxAmqpFrameSize(int maxAmqpFrameSize)voidsetMaxFrameSize(long maxFrameSize)voidsetProducerCredit(int producerCredit)voidsetProtocolResetListener(AmqpWireFormat.ResetListener listener)voidsetTransformer(String transformer)voidsetVersion(int version)Objectunmarshal(DataInput dataIn)Objectunmarshal(ByteSequence packet)
-
-
-
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
-
-
Constructor Detail
-
AmqpWireFormat
public AmqpWireFormat()
-
-
Method Detail
-
marshal
public ByteSequence marshal(Object command) throws IOException
- Specified by:
marshalin interfaceorg.apache.activemq.wireformat.WireFormat- Throws:
IOException
-
unmarshal
public Object unmarshal(ByteSequence packet) throws IOException
- Specified by:
unmarshalin interfaceorg.apache.activemq.wireformat.WireFormat- Throws:
IOException
-
marshal
public void marshal(Object command, DataOutput dataOut) throws IOException
- Specified by:
marshalin interfaceorg.apache.activemq.wireformat.WireFormat- Throws:
IOException
-
unmarshal
public Object unmarshal(DataInput dataIn) throws IOException
- Specified by:
unmarshalin interfaceorg.apache.activemq.wireformat.WireFormat- 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:
setVersionin interfaceorg.apache.activemq.wireformat.WireFormat
-
getVersion
public int getVersion()
- Specified by:
getVersionin interfaceorg.apache.activemq.wireformat.WireFormat
-
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)
-
-