A queue holds messages. Ideally, a queue is created per work type. For
example, if you want to compress files, you would create a queue dedicated to
this job. Any application that reads from this queue would only compress
files.
Methods summary
public
mixed
|
#
setName( mixed $name )
Set the name (with validation).
Set the name (with validation).
Parameters
Returns
mixed $this
Throws
|
public
string
|
|
public
mixed
|
#
saveMetadata( array $params = array() )
Save this metadata both to the local object and the API.
Save this metadata both to the local object and the API.
Parameters
Returns
mixed
|
public
|
#
retrieveMetadata( )
Retrieve metadata from the API and set it to the local object.
Retrieve metadata from the API and set it to the local object.
|
public
Guzzle\Http\Message\Response
|
#
create( array $params = array() )
Create a new resource
Parameters
Returns
Guzzle\Http\Message\Response
Overrides
|
public
object
|
#
createJson( )
Provides JSON for create request body
Provides JSON for create request body
Returns
object
Throws
Overrides
|
public
string
|
#
primaryKeyField( )
Returns the primary key field for the object
Returns the primary key field for the object
Returns
string
Overrides
|
public
Guzzle\Http\Message\Response
|
#
update( array $params = array() )
Update a resource
Parameters
Returns
Guzzle\Http\Message\Response
Overrides
|
public
object
|
#
getStats( )
This operation returns queue statistics including how many messages are in
the queue, broken out by status.
This operation returns queue statistics including how many messages are in
the queue, broken out by status.
Returns
object
|
public
OpenCloud\Queues\Resource\Message
|
#
getMessage( string|null $id = null )
Gets a message either by a specific ID, or, if no ID is specified, just an
empty Message object.
Gets a message either by a specific ID, or, if no ID is specified, just an
empty Message object.
Parameters
- $id
string|null $id If a string, then the service will retrieve an individual message based on
its specific ID. If NULL, then an empty object is returned for further use.
Returns
|
public
boolean
|
#
createMessage( array $params )
Post an individual message.
Post an individual message.
Parameters
Returns
boolean
|
public
boolean
|
#
createMessages( array $messages )
Post multiple messages.
Parameters
Returns
boolean
|
public
Collection
|
#
listMessages( array $options = array() )
Lists messages according to certain filter options. Results are ordered by
age, oldest message first. All of the parameters are optional.
Lists messages according to certain filter options. Results are ordered by
age, oldest message first. All of the parameters are optional.
Parameters
- $options
array $options An associative array of filtering parameters: - ids (array) A
two-dimensional array of IDs to retrieve. - claim_id (string) The claim ID to
which the message is associated. - marker (string) An opaque string that the
client can use to request the next batch of messages. If not specified, the API
will return all messages at the head of the queue (up to limit). - limit
(integer) A number up to 20 (the default, but is configurable) queues to return.
If not specified, it defaults to 10. - echo (bool) Determines whether the API
returns a client's own messages, as determined by the uuid portion of the
User-Agent header. If not specified, echo defaults to FALSE. - include_claimed
(bool) Determines whether the API returns claimed messages as well as unclaimed
messages. If not specified, defaults to FALSE (i.e. only unclaimed messages are
returned).
Returns
Collection
|
public
boolean
|
#
deleteMessages( array $ids )
This operation immediately deletes the specified messages, providing a means
for bulk deletes.
This operation immediately deletes the specified messages, providing a means
for bulk deletes.
Parameters
- $ids
array $ids Two-dimensional array of IDs to be deleted
Returns
boolean
|
public
|
#
claimMessages( array $options = array() )
This operation claims a set of messages, up to limit, from oldest to newest,
skipping any that are already claimed. If no unclaimed messages are available,
FALSE is returned.
This operation claims a set of messages, up to limit, from oldest to newest,
skipping any that are already claimed. If no unclaimed messages are available,
FALSE is returned.
You should delete the message when you have finished processing it, before
the claim expires, to ensure the message is processed only once. Be aware that
you must call the delete() method on the Message object and pass in the Claim
ID, rather than relying on the service's bulk delete deleteMessages() method.
This is so that the server can return an error if the claim just expired, giving
you a chance to roll back your processing of the given message, since another
worker will likely claim the message and process it.
Just as with a message's age, the age given for the claim is relative to the
server's clock, and is useful for determining how quickly messages are getting
processed, and whether a given message's claim is about to expire.
When a claim expires, it is removed, allowing another client worker to claim
the message in the case that the original worker fails to process it.
Parameters
|
public
OpenCloud\Queues\Resource\Claim
|
#
getClaim( integer $id = null )
If an ID is supplied, the API is queried for a persistent object; otherwise
an empty object is returned.
If an ID is supplied, the API is queried for a persistent object; otherwise
an empty object is returned.
Parameters
Returns
|