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

queue

The queue this message is from, an object of class StorageQueue

id

The message ID.

insertion_time

The message insertion (creation) time.

expiry_time

The message expiration time.

text

The message text.

receipt

A 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_time

The time when this message will be next visible.

dequeue_count

The 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
message

Details about the message.

queue

Object 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_timeout

The new visibility timeout (time to when the message will again be visible).

text

Optionally, 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
deep

Whether 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)

[Package AzureQstor version 1.0.1 Index]