Class DefaultCommandsQueueRepository
- java.lang.Object
-
- com.snowflake.connectors.taskreactor.commands.queue.DefaultCommandsQueueRepository
-
- All Implemented Interfaces:
CommandsQueueRepository
public class DefaultCommandsQueueRepository extends Object implements CommandsQueueRepository
Default implementation of theCommandsQueueRepository
used by the Task Reactor.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.snowflake.connectors.taskreactor.commands.queue.CommandsQueueRepository
CommandsQueueRepository.ColumnName
-
-
Field Summary
-
Fields inherited from interface com.snowflake.connectors.taskreactor.commands.queue.CommandsQueueRepository
EMPTY_COMMAND_PAYLOAD
-
-
Constructor Summary
Constructors Constructor Description DefaultCommandsQueueRepository(Session session, Identifier instanceSchema)
Creates aDefaultCommandsQueueRepository
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.CommandsQueueRepository
addCommandWithEmptyPayload
-
-
-
-
Constructor Detail
-
DefaultCommandsQueueRepository
public DefaultCommandsQueueRepository(Session session, Identifier instanceSchema)
Creates aDefaultCommandsQueueRepository
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 interfaceCommandsQueueRepository
- Returns:
- a list of the fetched commands
-
add
public void add(Command.CommandType type, Variant payload)
Creates a new command.- Specified by:
add
in interfaceCommandsQueueRepository
- 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 interfaceCommandsQueueRepository
- 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 interfaceCommandsQueueRepository
-
-