public class

AMQCommand

extends Object
implements Command
java.lang.Object
   ↳ com.rabbitmq.client.impl.AMQCommand

Class Overview

AMQ-specific implementation of Command which accumulates method, header and body from a series of frames, unless these are supplied at construction time.

Concurrency
This class is thread-safe.

Summary

Public Constructors
AMQCommand()
Construct a command ready to fill in by reading frames
AMQCommand(Method method)
Construct a command with just a method, and without header or body.
AMQCommand(Method method, AMQContentHeader contentHeader, byte[] body)
Construct a command with a specified method, header and body.
Public Methods
static void checkPreconditions()
Called to check internal code assumptions.
byte[] getContentBody()
Public API - Retrieves the body byte array that travelled as part of this Command, if any.
AMQContentHeader getContentHeader()
Public API - Retrieves the ContentHeader subclass instance held as part of this Command, if any.
Method getMethod()
Public API - Retrieves the Method held within this Command.
boolean handleFrame(Frame f)
String toString(boolean suppressBody)
String toString()
void transmit(AMQChannel channel)
Sends this command down the named channel on the channel's connection, possibly in multiple frames.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.rabbitmq.client.Command

Public Constructors

public AMQCommand ()

Construct a command ready to fill in by reading frames

public AMQCommand (Method method)

Construct a command with just a method, and without header or body.

Parameters
method the wrapped method

public AMQCommand (Method method, AMQContentHeader contentHeader, byte[] body)

Construct a command with a specified method, header and body.

Parameters
method the wrapped method
contentHeader the wrapped content header
body the message body data

Public Methods

public static void checkPreconditions ()

Called to check internal code assumptions.

public byte[] getContentBody ()

Public API - Retrieves the body byte array that travelled as part of this Command, if any.

Returns
  • the Command's content body, or null if none

public AMQContentHeader getContentHeader ()

Public API - Retrieves the ContentHeader subclass instance held as part of this Command, if any. Downcast to one of the inner classes of AMQP, for instance AMQP.BasicProperties, as appropriate.

Returns

public Method getMethod ()

Public API - Retrieves the Method held within this Command. Downcast to concrete (implementation-specific!) subclasses as necessary.

Returns
  • the command's method.

public boolean handleFrame (Frame f)

Throws
IOException

public String toString (boolean suppressBody)

public String toString ()

public void transmit (AMQChannel channel)

Sends this command down the named channel on the channel's connection, possibly in multiple frames.

Parameters
channel the channel on which to transmit the command
Throws
IOException if an error is encountered