AMPS C# Client  5.3.5.0
AMPS C# Client for .NET
AMPS.Client.Command Class Reference

Command is an encapsulation of a single AMPS command sent by the client. Using Command you can build valid commands to be executed either synchronously or asynchronously via the Client execute() method or asynchronously via the executeAsync() methods. More...

Public Member Functions

string getSOWKeys ()
 
Returns
The SOW Keys.

 
string getSowKeys ()
 Returns the SOW keys on this command. More...
 
Command setSOWKeys (string sowKeys)
 The SowKeys for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKeys method on a message. More...
 
Command setSowKeys (string sowKeys)
 The SowKeys for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKeys method on a message. More...
 
string getSOWKey ()
 
Returns
the SOW Key

 
string getSowKey ()
 Retrieves the State of the World (SOW) key associated with this instance. More...
 
Command setSOWKey (string sowKey)
 The SowKey for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKey method on a message. More...
 
Command setSowKey (string sowKey)
 The SowKey for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKey method on a message. More...
 
bool isSubscribe ()
 Checks if the current command represents a subscription. More...
 
bool isSow ()
 Checks if the current command represents a State of the World (SOW) operation. More...
 
bool needsSequenceNumber ()
 Checks whether a sequence number is needed for this message based on the message command. More...
 
 Command ()
 Create a new Command with no command type or arguments set. Provides a starting point for creating 'Command' objects. More...
 
 Command (Message.Commands command_)
 Initializes a new instance of the Command class with the specified AMPS command type. More...
 
 Command (string command_)
 Create a Command with the Command field set. More...
 
Command reset (Message.Commands command_)
 Resets this command with a new Command type and re-initializes all other fields. More...
 
Command reset (string command_)
 Resets this command with a new Command type and re-initializes all other fields. More...
 
CommandId getCommandId ()
 Gets the automatically generated command ID associated with this command. More...
 
Command setCommandId (CommandId commandId)
 Sets the command ID for this command. More...
 
CommandId getQueryId ()
 Retrieve the query identifier associated with the 'Command' object. This method is used to access the identifier set by the 'setQueryId' method when needed. It allows you to read or obtain the QueryId for tracking, monitoring, or correlating messages within the messaging system. More...
 
Command setQueryId (CommandId queryId)
 Set a custom QueryId for this Command. The QueryId is a unique identifier that you can assign to this command. You have the option to set this independently of the Command so customizing the QueryId provides flexibility as you can assign QueryIds based on application-specific logic. When the QueryId is independent of the Command in AMPS, it means you are not bound by the CommandId for assigning QueryIds. Instead, you have the freedom to create custom identifiers for queries and messages, which can be valuable when you have scenarios when you need to correlate responses from different types of queries based on shared attributes other than the CommandId. More...
 
Message.Commands getCommand ()
 Gets the AMPS command type associated with this command. More...
 
Command setCommand (Message.Commands command)
 Sets the AMPS command type for this command. More...
 
string getTopic ()
 Gets the topic associated with this command. More...
 
Command setTopic (string topic)
 Sets the topic for this command using a string representation. More...
 
Command setTopic (byte[] topic, int offset, int length)
 Sets the topic for this command using raw bytes, offset, and length. More...
 
string getFilter ()
 Gets the filter associated with this command. More...
 
Command setFilter (string filter)
 Sets the filter for this command. More...
 
string getOrderBy ()
 Gets the orderBy associated with this command. More...
 
Command setOrderBy (string orderBy)
 Sets the orderBy for this command. More...
 
CommandId getSubId ()
 Get the subId set on this command. More...
 
Command setSubId (CommandId subId)
 Sets the subId for this command. More...
 
Command setSubId (string subId)
 Sets the subId for this command using a string representation. More...
 
string getBookmark ()
 Gets the bookmark associated with this command. More...
 
Command setBookmark (string bookmark)
 Sets the bookmark for this command. More...
 
string getOptions ()
 Gets the options associated with this command. More...
 
Command setOptions (string options)
 Set the options for this command. Options are a comma-delimited list. More...
 
Message.AckTypes getAckType ()
 Gets the ackType associated with this command. More...
 
Command setAckType (Message.AckTypes ackType)
 Sets the ackType for this command. Different ackTypes are supported for each command. See the Command Reference for details. More...
 
Command addAckType (Message.AckTypes ackType)
 Adds an additional ackType to the ackTypes already set for this Command. More...
 
string getData ()
 Gets the data associated with this command. More...
 
Command setData (string data)
 Sets the data for this command. More...
 
Command setData (byte[] data, int offset, int length)
 Sets the raw data for this command. More...
 
Command setData (CompositeMessageBuilder builder)
 Set the data for this command. More...
 
long getTimeout ()
 Gets the timeout associated with this command. More...
 
Command setTimeout (long timeout)
 Set the timeout for this command (in milliseconds). If the client does not receive and consume a processed ack within the specified timeout, this method throws an exception. Notice that the timeout is monitored in the AMPS client, not on the server, and the client receive thread receives and consumes the ack from the server. More...
 
int getTopN ()
 Get the topN value for this command.

Returns
The topN.

 
Command setTopN (int topN)
 Sets the top_n header for this command. This parameter sets a maximum number of records returned by a SOW query. This should usually be set as part of the command's options string, rather than using this method.

Parameters
topNthe topN to set
Returns
The current instance of Command.

 
int getBatchSize ()
 Get the batchSize set on this command. More...
 
Command setBatchSize (int batchSize)
 Set the batchSize for this command. This sets the number of records returned in a batch during a SOW query. More...
 
int getExpiration ()
 Get the expiration set on this command. This method returns 0 if no expiration is set. Use Command#hasExpiration()to check if an expiration is set. More...
 
bool hasExpiration ()
 Returns true if this command has an expiration set. More...
 
Command setExpiration (int expiration)
 Set the expiration for this command. For a publish command to a SOW topic or a queue, the expiration sets the amount of time to retain the message in the SOW or the queue. More...
 
void unsetExpiration ()
 Clears any expiration value set on self. More...
 
Command setClientSequenceNumber (ulong seqNumber)
 Sets the client sequence number for this command. More...
 
ulong getClientSequenceNumber ()
 Get the client sequence number set on this command. More...
 
Command setCorrelationId (String correlationId_)
 Sets the correlation Id for this command. The correlation ID is an arbitrary string that can be used for whatever purpose the application needs. It is not interpreted or used by AMPS. However, the correlation ID must only contain characters that are valid base64 encoded characters. More...
 
String getCorrelationId ()
 Gets the correlation ID set with this command. More...
 

Detailed Description

Command is an encapsulation of a single AMPS command sent by the client. Using Command you can build valid commands to be executed either synchronously or asynchronously via the Client execute() method or asynchronously via the executeAsync() methods.

Command is designed to be used as a "builder" enabling AMPS commands to be built easily, for example:



Client client = new Client(...);
for(Message m : client.execute(new Command("sow").setTopic("topic"))) { ... }


Constructor & Destructor Documentation

◆ Command() [1/3]

AMPS.Client.Command.Command ( )
inline

Create a new Command with no command type or arguments set. Provides a starting point for creating 'Command' objects.

◆ Command() [2/3]

AMPS.Client.Command.Command ( Message.Commands  command_)
inline

Initializes a new instance of the Command class with the specified AMPS command type.

Parameters
command_The Message.Commands value indicating the AMPS command.

◆ Command() [3/3]

AMPS.Client.Command.Command ( string  command_)
inline

Create a Command with the Command field set.

Parameters
command_A string indicating the AMPS command.

Member Function Documentation

◆ addAckType()

Command AMPS.Client.Command.addAckType ( Message.AckTypes  ackType)
inline

Adds an additional ackType to the ackTypes already set for this Command.

Parameters
ackTypethe ackType to add

◆ getAckType()

Message.AckTypes AMPS.Client.Command.getAckType ( )
inline

Gets the ackType associated with this command.

Returns
The ackType.

◆ getBatchSize()

int AMPS.Client.Command.getBatchSize ( )
inline

Get the batchSize set on this command.

Returns
The batchSize.

◆ getBookmark()

string AMPS.Client.Command.getBookmark ( )
inline

Gets the bookmark associated with this command.

Returns
The bookmark as a string.

◆ getClientSequenceNumber()

ulong AMPS.Client.Command.getClientSequenceNumber ( )
inline

Get the client sequence number set on this command.

Returns
The client sequence number generated for this command, or 0 if none was generated.

◆ getCommand()

Message.Commands AMPS.Client.Command.getCommand ( )
inline

Gets the AMPS command type associated with this command.

Returns
The command type.

◆ getCommandId()

CommandId AMPS.Client.Command.getCommandId ( )
inline

Gets the automatically generated command ID associated with this command.

Returns
The commandId, which is automatically generated for some command types.

◆ getCorrelationId()

String AMPS.Client.Command.getCorrelationId ( )
inline

Gets the correlation ID set with this command.

Returns
The correlation id.

◆ getData()

string AMPS.Client.Command.getData ( )
inline

Gets the data associated with this command.

Returns
The data.

◆ getExpiration()

int AMPS.Client.Command.getExpiration ( )
inline

Get the expiration set on this command. This method returns 0 if no expiration is set. Use Command#hasExpiration()to check if an expiration is set.

Returns
The expiration.

◆ getFilter()

string AMPS.Client.Command.getFilter ( )
inline

Gets the filter associated with this command.

Returns
The filter.

◆ getOptions()

string AMPS.Client.Command.getOptions ( )
inline

Gets the options associated with this command.

Returns
The options.

◆ getOrderBy()

string AMPS.Client.Command.getOrderBy ( )
inline

Gets the orderBy associated with this command.

Returns
The orderBy.

◆ getQueryId()

CommandId AMPS.Client.Command.getQueryId ( )
inline

Retrieve the query identifier associated with the 'Command' object. This method is used to access the identifier set by the 'setQueryId' method when needed. It allows you to read or obtain the QueryId for tracking, monitoring, or correlating messages within the messaging system.

Returns
The query identifier ('CommandId') previously set using the 'setQueryId' method, or 'null' if not set.

◆ getSowKey()

string AMPS.Client.Command.getSowKey ( )
inline

Retrieves the State of the World (SOW) key associated with this instance.

Returns
The SOW Key.

◆ getSowKeys()

string AMPS.Client.Command.getSowKeys ( )
inline

Returns the SOW keys on this command.

Returns
The SOW Keys.

◆ getSubId()

CommandId AMPS.Client.Command.getSubId ( )
inline

Get the subId set on this command.

Returns
The subId.

◆ getTimeout()

long AMPS.Client.Command.getTimeout ( )
inline

Gets the timeout associated with this command.

Returns
The timeout value.

◆ getTopic()

string AMPS.Client.Command.getTopic ( )
inline

Gets the topic associated with this command.

Returns
The topic.

◆ hasExpiration()

bool AMPS.Client.Command.hasExpiration ( )
inline

Returns true if this command has an expiration set.

Returns
True if an expiration is set.

◆ isSow()

bool AMPS.Client.Command.isSow ( )
inline

Checks if the current command represents a State of the World (SOW) operation.

Returns
True if this command is a sow query, otherwise false.

◆ isSubscribe()

bool AMPS.Client.Command.isSubscribe ( )
inline

Checks if the current command represents a subscription.

Returns
True if this command is a subscription command, otherwise false.

◆ needsSequenceNumber()

bool AMPS.Client.Command.needsSequenceNumber ( )
inline

Checks whether a sequence number is needed for this message based on the message command.

Returns
True if this command can be associated with a client sequence number, otherwise false.

◆ reset() [1/2]

Command AMPS.Client.Command.reset ( Message.Commands  command_)
inline

Resets this command with a new Command type and re-initializes all other fields.

Parameters
command_A Message.Commands value indicating the AMPS command.

◆ reset() [2/2]

Command AMPS.Client.Command.reset ( string  command_)
inline

Resets this command with a new Command type and re-initializes all other fields.

Parameters
command_A string value indicating the AMPS command.

◆ setAckType()

Command AMPS.Client.Command.setAckType ( Message.AckTypes  ackType)
inline

Sets the ackType for this command. Different ackTypes are supported for each command. See the Command Reference for details.

Parameters
ackTypeThe ackType to set.
Returns
The current instance of Command.

◆ setBatchSize()

Command AMPS.Client.Command.setBatchSize ( int  batchSize)
inline

Set the batchSize for this command. This sets the number of records returned in a batch during a SOW query.

Parameters
batchSizeThe batchSize to set.
Returns
The current instance of Command.

◆ setBookmark()

Command AMPS.Client.Command.setBookmark ( string  bookmark)
inline

Sets the bookmark for this command.

Parameters
bookmarkThe bookmark to set.
Returns
The current instance of Command.

◆ setClientSequenceNumber()

Command AMPS.Client.Command.setClientSequenceNumber ( ulong  seqNumber)
inline

Sets the client sequence number for this command.

Parameters
seqNumberSequence number for this command.
Returns
The current instance of Command.

◆ setCommand()

Command AMPS.Client.Command.setCommand ( Message.Commands  command)
inline

Sets the AMPS command type for this command.

Parameters
commandThe command type to set.
Returns
The current instance of Command.

◆ setCommandId()

Command AMPS.Client.Command.setCommandId ( CommandId  commandId)
inline

Sets the command ID for this command.

Parameters
commandIdThe commandId to set.
Returns
This Command object with the specified identifier.

◆ setCorrelationId()

Command AMPS.Client.Command.setCorrelationId ( String  correlationId_)
inline

Sets the correlation Id for this command. The correlation ID is an arbitrary string that can be used for whatever purpose the application needs. It is not interpreted or used by AMPS. However, the correlation ID must only contain characters that are valid base64 encoded characters.

Parameters
correlationId_The CorrelationId is a user provided string included in the log message for a logon. AMPS does not interpret or use this string for any other purpose.
Returns
The current instance of Command.

◆ setData() [1/3]

Command AMPS.Client.Command.setData ( byte[]  data,
int  offset,
int  length 
)
inline

Sets the raw data for this command.

Parameters
dataThe raw bytes to be used for the data.
offsetThe offset into data where the data begins.
lengthThe length of the data.
Returns
The current instance of Command.

◆ setData() [2/3]

Command AMPS.Client.Command.setData ( CompositeMessageBuilder  builder)
inline

Set the data for this command.

Parameters
builderA CompositeMessageBuilder to set self's data from.

◆ setData() [3/3]

Command AMPS.Client.Command.setData ( string  data)
inline

Sets the data for this command.

Parameters
dataThe data to set.
Returns
The current instance of Command.

◆ setExpiration()

Command AMPS.Client.Command.setExpiration ( int  expiration)
inline

Set the expiration for this command. For a publish command to a SOW topic or a queue, the expiration sets the amount of time to retain the message in the SOW or the queue.

Parameters
expirationThe expiration to set.
Returns
The current instance of Command.

◆ setFilter()

Command AMPS.Client.Command.setFilter ( string  filter)
inline

Sets the filter for this command.

Parameters
filterThe filter to set.
Returns
The current instance of Command.

◆ setOptions()

Command AMPS.Client.Command.setOptions ( string  options)
inline

Set the options for this command. Options are a comma-delimited list.

Parameters
optionsThe options to set.
Returns
The current instance of Command.

◆ setOrderBy()

Command AMPS.Client.Command.setOrderBy ( string  orderBy)
inline

Sets the orderBy for this command.

Parameters
orderByThe orderBy to set.
Returns
The current instance of Command.

◆ setQueryId()

Command AMPS.Client.Command.setQueryId ( CommandId  queryId)
inline

Set a custom QueryId for this Command. The QueryId is a unique identifier that you can assign to this command. You have the option to set this independently of the Command so customizing the QueryId provides flexibility as you can assign QueryIds based on application-specific logic. When the QueryId is independent of the Command in AMPS, it means you are not bound by the CommandId for assigning QueryIds. Instead, you have the freedom to create custom identifiers for queries and messages, which can be valuable when you have scenarios when you need to correlate responses from different types of queries based on shared attributes other than the CommandId.

Parameters
queryIdA unique query identifier to be associated with this Command.
Returns
This Command object with the specified query identifier.

◆ setSOWKey()

Command AMPS.Client.Command.setSOWKey ( string  sowKey)
inline

The SowKey for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKey method on a message.

Parameters
sowKeyThe sow keys to set.

◆ setSowKey()

Command AMPS.Client.Command.setSowKey ( string  sowKey)
inline

The SowKey for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKey method on a message.

Parameters
sowKeyThe sow keys to set.
Returns
Returns this instance so that various operations can be chained together.

◆ setSOWKeys()

Command AMPS.Client.Command.setSOWKeys ( string  sowKeys)
inline

The SowKeys for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKeys method on a message.

Parameters
sowKeysThe sow keys to set.

◆ setSowKeys()

Command AMPS.Client.Command.setSowKeys ( string  sowKeys)
inline

The SowKeys for a command are a comma-separated list of the keys that AMPS assigns to SOW messages. The SOW key for a message is available through the Message#getSowKeys method on a message.

Parameters
sowKeysThe sow keys to set.

◆ setSubId() [1/2]

Command AMPS.Client.Command.setSubId ( CommandId  subId)
inline

Sets the subId for this command.

Parameters
subIdThe subId to set.
Returns
The current instance of Command.

◆ setSubId() [2/2]

Command AMPS.Client.Command.setSubId ( string  subId)
inline

Sets the subId for this command using a string representation.

Parameters
subIdThe subId to set.
Returns
The current instance of Command.

◆ setTimeout()

Command AMPS.Client.Command.setTimeout ( long  timeout)
inline

Set the timeout for this command (in milliseconds). If the client does not receive and consume a processed ack within the specified timeout, this method throws an exception. Notice that the timeout is monitored in the AMPS client, not on the server, and the client receive thread receives and consumes the ack from the server.

Parameters
timeoutThe timeout to set.
Returns
The current instance of Command.

◆ setTopic() [1/2]

Command AMPS.Client.Command.setTopic ( byte[]  topic,
int  offset,
int  length 
)
inline

Sets the topic for this command using raw bytes, offset, and length.

Parameters
topicThe raw bytes to be used for the topic.
offsetThe offset into topic where the topic data begins.
lengthThe length of the topic.
Returns
The current instance of Command.

◆ setTopic() [2/2]

Command AMPS.Client.Command.setTopic ( string  topic)
inline

Sets the topic for this command using a string representation.

Parameters
topicThe topic to set.
Returns
The current instance of Command.

◆ unsetExpiration()

void AMPS.Client.Command.unsetExpiration ( )
inline

Clears any expiration value set on self.


The documentation for this class was generated from the following file: