Class DefaultCommandsQueue
- java.lang.Object
-
- com.snowflake.connectors.taskreactor.commands.queue.DefaultCommandsQueue
-
- All Implemented Interfaces:
CommandsQueue
public class DefaultCommandsQueue extends Object implements CommandsQueue
Default implementation of theCommandsQueue
used by the Task Reactor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.snowflake.connectors.taskreactor.commands.queue.CommandsQueue
CommandsQueue.ColumnName
-
-
Field Summary
-
Fields inherited from interface com.snowflake.connectors.taskreactor.commands.queue.CommandsQueue
EMPTY_COMMAND_PAYLOAD
-
-
Constructor Summary
Constructors Constructor Description DefaultCommandsQueue(Session session, Identifier instanceSchema)
Creates aDefaultCommandsQueue
object with all fields initialized.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Command.CommandType type, Variant payload)
Creates a new command.void
deleteById(String id)
Deletes the command with the given id.void
deleteUnsupportedCommands()
Deletes all commands of type that is not included in theCommand.CommandType
set of valuesList<Command>
fetchAllSupportedOrderedBySeqNo()
Retrieves all commands of valid type from the commands queue sorted ascending by the command sequence number.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.snowflake.connectors.taskreactor.commands.queue.CommandsQueue
addCommandWithEmptyPayload
-
-
-
-
Constructor Detail
-
DefaultCommandsQueue
public DefaultCommandsQueue(Session session, Identifier instanceSchema)
Creates aDefaultCommandsQueue
object with all fields initialized.- Parameters:
session
- Snowpark session objectinstanceSchema
- task reactor instance schema name
-
-
Method Detail
-
fetchAllSupportedOrderedBySeqNo
public List<Command> fetchAllSupportedOrderedBySeqNo()
Retrieves all commands of valid type from the commands queue sorted ascending by the command sequence number. This implementation assumes that there can be some commands in the queue with the invalid command type. These commands are filtered out from the queue.- Specified by:
fetchAllSupportedOrderedBySeqNo
in interfaceCommandsQueue
- Returns:
- a list of the fetched commands
-
add
public void add(Command.CommandType type, Variant payload)
Creates a new command.- Specified by:
add
in interfaceCommandsQueue
- Parameters:
type
- type of the commandpayload
- custom command payload appropriate for the command type
-
deleteById
public void deleteById(String id)
Deletes the command with the given id.- Specified by:
deleteById
in interfaceCommandsQueue
- Parameters:
id
- id of the command entity to be deleted
-
deleteUnsupportedCommands
public void deleteUnsupportedCommands()
Deletes all commands of type that is not included in theCommand.CommandType
set of values- Specified by:
deleteUnsupportedCommands
in interfaceCommandsQueue
-
-