| QueueMessage {AzureQstor} | R Documentation |
R6 class representing a message from an Azure storage queue
Description
This class stores the data, metadata and behaviour associated with a message.
To generate a message object, call one of the methods exposed by the StorageQueue class.
Public fields
queueThe queue this message is from, an object of class
StorageQueueidThe message ID.
insertion_timeThe message insertion (creation) time.
expiry_timeThe message expiration time.
textThe message text.
receiptA pop receipt. This is present if the message was obtained by means other than peeking, and is required for updating or deleting the message.
next_visible_timeThe time when this message will be next visible.
dequeue_countThe number of times this message has been read.
Methods
Public methods
Method new()
Creates a new message object. Rather than calling the new method manually, objects of this class should be created via the methods exposed by the StorageQueue object.
Usage
QueueMessage$new(message, queue)
Arguments
messageDetails about the message.
queueObject of class
StorageQueue.
Method delete()
Deletes this message from the queue.
Usage
QueueMessage$delete()
Returns
NULL, invisibly.
Method update()
Updates this message in the queue.
This operation can be used to continually extend the invisibility of a queue message. This functionality can be useful if you want a worker role to "lease" a message. For example, if a worker role calls get_messages and recognizes that it needs more time to process a message, it can continually extend the message's invisibility until it is processed. If the worker role were to fail during processing, eventually the message would become visible again and another worker role could process it.
Usage
QueueMessage$update(visibility_timeout, text = self$text)
Arguments
visibility_timeoutThe new visibility timeout (time to when the message will again be visible).
textOptionally, new message text, either a raw or character vector. If a raw vector, it is base64-encoded, and if a character vector, it is collapsed into a single string before being sent to the queue.
Returns
The message object, invisibly.
Method print()
Print method for this class.
Usage
QueueMessage$print(...)
Arguments
...Not currently used.
Returns
The message object, invisibly.
Method clone()
The objects of this class are cloneable with this method.
Usage
QueueMessage$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## Not run:
endp <- storage_endpoint("https://mystorage.queue.core.windows.net", key="key")
queue <- storage_queue(endp, "queue1")
msg <- queue$get_message()
msg$update(visibility_timeout=60, text="updated message")
msg$delete()
## End(Not run)