fluke.queues
- class fluke.queues.AmazonSQSQueue(auth: AWSAuth, queue: str)[source]
This class represents an Amazon SQS queue.
- Parameters
auth (AWSAuth) – An
AWSAuth
instance used in authenticating with AWS.queue (str) – The name of the Amazon SQS queue to which a connection is to be established.
- clear(suppress_output: bool = False) None [source]
Empties the queue by deleting all messages.
- Parameters
suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.
- count() int [source]
Returns the total number of messages that are residing within the queue at the time of the request.
- get_name() str
Returns the name of the queue to which a connection has been established.
- is_open() bool [source]
Returns a value indicating whether this handler’s underlying client connection is open or not.
- peek(suppress_output: bool = False) list[str] [source]
Returns a list containing at most ten messages currently residing within the queue.
- Parameters
suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.- Note
This method does not go on to explicitly remove messages from the queue. However, any messages returned by this method will have their “receive count” increased, which in turn might result in said messages being removed from the queue in case the queue’s maximum receive count threshold is exceeded.
- poll(num_messages: Optional[int] = None, batch_size: int = 10, polling_frequency: Optional[int] = None, pre_delivery_delete: bool = False, suppress_output: bool = False) Iterator[list[str]] [source]
Iterates through the messages available in the queue in distinct batches, deleting them in the process of doing so.
- Parameters
num_messages (int | None) – The number of messages to iterate through. If set to
None
, then the queue is constantly querried for new messages until there are none left. Defaults toNone
.batch_size (int) – The maximum number of messages a single batch may contain. Deafults to
10
.polling_frequency (int | None) – If set to an integer value, then the queue is going to be being polled at regular time intervals equal to said value in seconds. If set to
None
, then the queue is only polled once. Defaults toNone
.pre_delivery_delete (bool) – Indicates whether a batch of messages is to be removed from the queue before or after its delivery. If set to
True
, then it is guaranteed that any delivered messages will have already been removed from the queue, thus reducing the likelihood of fetching the same message twice. If set toFalse
, then any delivered messages are only deleted just before the delivery of the next batch of messages, thus preventing from any messages being lost in case an error occurs during their processing. Defaults toFalse
.suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.
- push(message: str, suppress_output: bool = False) bool [source]
Pushes the provided message into the queue. Returns
True
if said message was successfully pushed into the queue, else returnsFalse
.- Parameters
message (str) – A string message.
suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.
- class fluke.queues.AzureStorageQueue(auth: AzureAuth, queue: str)[source]
A class used in handling the HTTP connection to an Azure Queue Storage queue.
- Parameters
auth (AzureAuth) – An
AzureAuth
instance used in authenticating with Microsoft Azure.queue (str) – The name of the Azure Queue Storage queue to which a connection is to be established.
- clear(suppress_output: bool = False) None [source]
Empties the queue by deleting all messages.
- Parameters
suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.
- count() int [source]
Returns the total number of messages that are residing within the queue at the time of the request.
- get_name() str
Returns the name of the queue to which a connection has been established.
- is_open() bool [source]
Returns a value indicating whether this handler’s underlying client connection is open or not.
- peek(suppress_output: bool = False) list[str] [source]
Returns a list containing at most ten messages currently residing within the queue.
- Parameters
suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.- Note
This method does not go on to explicitly remove messages from the queue. However, any messages returned by this method will have their “receive count” increased, which in turn might result in said messages being removed from the queue in case the queue’s maximum receive count threshold is exceeded.
- poll(num_messages: Optional[int] = None, batch_size: int = 10, polling_frequency: Optional[int] = None, pre_delivery_delete: bool = False, suppress_output: bool = False) Iterator[list[str]] [source]
Iterates through the messages available in the queue in distinct batches, deleting them in the process of doing so.
- Parameters
num_messages (int | None) – The number of messages to iterate through. If set to
None
, then the queue is constantly querried for new messages until there are none left. Defaults toNone
.batch_size (int) – The maximum number of messages a single batch may contain. Deafults to
10
.polling_frequency (int | None) – If set to an integer value, then the queue is going to be being polled at regular time intervals equal to said value in seconds. If set to
None
, then the queue is only polled once. Defaults toNone
.pre_delivery_delete (bool) – Indicates whether a batch of messages is to be removed from the queue before or after its delivery. If set to
True
, then it is guaranteed that any delivered messages will have already been removed from the queue, thus reducing the likelihood of fetching the same message twice. If set toFalse
, then any delivered messages are only deleted just before the delivery of the next batch of messages, thus preventing from any messages being lost in case an error occurs during their processing. Defaults toFalse
.suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.
- push(message: str, suppress_output: bool = False) bool [source]
Pushes the provided message into the queue. Returns
True
if said message was successfully pushed into the queue, else returnsFalse
.- Parameters
message (str) – A string message.
suppress_output (bool) – If set to
True
, then suppresses all output. Defaults toFalse
.