QueueClient¶
-
class
oci.queue.
QueueClient
(config, **kwargs)¶ Use the Queue API to produce and consume messages, create queues, and manage related items. For more information, see [Queue](/iaas/Content/queue/overview.htm).
Methods
__init__
(config, **kwargs)Creates a new service client delete_message
(queue_id, message_receipt, …)Deletes the message represented by the receipt from the queue. delete_messages
(queue_id, …)Deletes multiple messages from the queue or the consumer group. get_messages
(queue_id, **kwargs)Consumes messages from the queue. get_stats
(queue_id, **kwargs)Gets the statistics for the queue and its dead letter queue. list_channels
(queue_id, **kwargs)Gets the list of IDs of non-empty channels. put_messages
(queue_id, put_messages_details, …)Puts messages into the queue. update_message
(queue_id, message_receipt, …)Updates the visibility of the message represented by the receipt. update_messages
(queue_id, …)Updates multiple messages in the queue or the consumer group. -
__init__
(config, **kwargs)¶ Creates a new service client
Parameters: - config (dict) – Configuration keys and values as per SDK and Tool Configuration.
The
from_file()
method can be used to load configuration from a file. Alternatively, adict
can be passed. You can validate_config the dict usingvalidate_config()
- service_endpoint (str) – (optional)
The endpoint of the service to call using this client. For example
https://iaas.us-ashburn-1.oraclecloud.com
. If this keyword argument is not provided then it will be derived using the region in the config parameter. You should only provide this keyword argument if you have an explicit need to specify a service endpoint. - timeout (float or tuple(float, float)) – (optional) The connection and read timeouts for the client. The default values are connection timeout 10 seconds and read timeout 60 seconds. This keyword argument can be provided as a single float, in which case the value provided is used for both the read and connection timeouts, or as a tuple of two floats. If a tuple is provided then the first value is used as the connection timeout and the second value as the read timeout.
- signer (
AbstractBaseSigner
) –(optional) The signer to use when signing requests made by the service client. The default is to use a
Signer
based on the values provided in the config parameter.One use case for this parameter is for Instance Principals authentication by passing an instance of
InstancePrincipalsSecurityTokenSigner
as the value for this keyword argument - retry_strategy (obj) –
(optional) A retry strategy to apply to all calls made by this service client (i.e. at the client level). There is no retry strategy applied by default. Retry strategies can also be applied at the operation level by passing a
retry_strategy
keyword argument as part of calling the operation. Any value provided at the operation level will override whatever is specified at the client level.This should be one of the strategies available in the
retry
module. A convenienceDEFAULT_RETRY_STRATEGY
is also available. The specifics of the default retry strategy are described here. - circuit_breaker_strategy (obj) – (optional)
A circuit breaker strategy to apply to all calls made by this service client (i.e. at the client level).
This client uses
DEFAULT_CIRCUIT_BREAKER_STRATEGY
as default if no circuit breaker strategy is provided. The specifics of circuit breaker strategy are described here. - circuit_breaker_callback (function) – (optional) Callback function to receive any exceptions triggerred by the circuit breaker.
- client_level_realm_specific_endpoint_template_enabled (bool) – (optional) A boolean flag to indicate whether or not this client should be created with realm specific endpoint template enabled or disable. By default, this will be set as None.
- allow_control_chars – (optional) allow_control_chars is a boolean to indicate whether or not this client should allow control characters in the response object. By default, the client will not allow control characters to be in the response object.
- config (dict) – Configuration keys and values as per SDK and Tool Configuration.
The
-
delete_message
(queue_id, message_receipt, **kwargs)¶ Deletes the message represented by the receipt from the queue. You must use the messages endpoint to delete messages. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint.Parameters: - queue_id (str) – (required) The unique queue identifier.
- message_receipt (str) – (required) The receipt of the message retrieved from a GetMessages call.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation usesDEFAULT_RETRY_STRATEGY
as default if no retry strategy is provided. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of type NoneReturn type: Example: Click here to see an example of how to use delete_message API.
-
delete_messages
(queue_id, delete_messages_details, **kwargs)¶ Deletes multiple messages from the queue or the consumer group. Only messages from the same queue/consumer group can be deleted at once. You must use the messages endpoint to delete messages. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint.Parameters: - queue_id (str) – (required) The unique queue identifier.
- delete_messages_details (oci.queue.models.DeleteMessagesDetails) – (required) Details for the messages to delete.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation usesDEFAULT_RETRY_STRATEGY
as default if no retry strategy is provided. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typeDeleteMessagesResult
Return type: Example: Click here to see an example of how to use delete_messages API.
-
get_messages
(queue_id, **kwargs)¶ Consumes messages from the queue. You must use the messages endpoint to consume messages. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint. GetMessages accepts optional channelFilter query parameter that can filter source channels of the messages. When channelFilter is present, service will return available messages from the channel which ID exactly matched the filter. When filter is not specified, messages will be returned from a random non-empty channel within a queue.Parameters: - queue_id (str) – (required) The unique queue identifier.
- visibility_in_seconds (int) –
(optional) If the visibilityInSeconds parameter is set, messages will be hidden for visibilityInSeconds seconds and won’t be consumable by other consumers during that time. If it isn’t set it defaults to the value set at the queue level.
Using a visibilityInSeconds value of 0 effectively acts as a peek functionality. Messages retrieved that way aren’t meant to be deleted because they will most likely be delivered to another consumer as their visibility won’t change, but will still increase the delivery count by one.
- timeout_in_seconds (int) –
(optional) If the timeoutInSeconds parameter isn’t set or it is set to a value greater than 0, the request is using the long-polling mode and will only return when a message is available for consumption (it does not wait for limit messages but still only returns at-most limit messages) or after timeoutInSeconds seconds (in which case it will return an empty response), whichever comes first.
If the parameter is set to 0, the request is using the short-polling mode and immediately returns whether messages have been retrieved or not. In same rare-cases a long-polling request could be interrupted (returned with empty response) before the end of the timeout.
- limit (int) – (optional) The limit parameter controls how many messages is returned at-most.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- channel_filter (str) – (optional) Optional parameter to filter the channels.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation will not retry by default, users can also use the convenientDEFAULT_RETRY_STRATEGY
provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typeGetMessages
Return type: Example: Click here to see an example of how to use get_messages API.
-
get_stats
(queue_id, **kwargs)¶ Gets the statistics for the queue and its dead letter queue. You must use the messages endpoint to get a queue’s statistics. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint.Parameters: - queue_id (str) – (required) The unique queue identifier.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- channel_id (str) – (optional) Id to specify channel.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation usesDEFAULT_RETRY_STRATEGY
as default if no retry strategy is provided. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typeQueueStats
Return type: Example: Click here to see an example of how to use get_stats API.
-
list_channels
(queue_id, **kwargs)¶ Gets the list of IDs of non-empty channels. It will return an approximate list of IDs of non-empty channels. That information is based on the queue level statistics. API supports optional channelFilter parameter which will filter the returned results according to the specified filter. List of channel IDs is approximate, because statistics is refreshed once per-second, and that list represents a snapshot of the past information. API is paginated.
Parameters: - queue_id (str) – (required) The unique queue identifier.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- limit (int) –
(optional) For list pagination. The maximum number of results per page, or items to return in a paginated “List” call. For important details about how pagination works, see List Pagination.
- page (str) –
(optional) For list pagination. The value of the opc-next-page response header from the previous “List” call. For important details about how pagination works, see List Pagination.
- channel_filter (str) – (optional) Optional parameter to filter the channels.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation usesDEFAULT_RETRY_STRATEGY
as default if no retry strategy is provided. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typeChannelCollection
Return type: Example: Click here to see an example of how to use list_channels API.
-
put_messages
(queue_id, put_messages_details, **kwargs)¶ Puts messages into the queue. You must use the messages endpoint to produce messages. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint.Parameters: - queue_id (str) – (required) The unique queue identifier.
- put_messages_details (oci.queue.models.PutMessagesDetails) – (required) Details for the messages to publish.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation will not retry by default, users can also use the convenientDEFAULT_RETRY_STRATEGY
provided by the SDK to enable retries for it. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typePutMessages
Return type: Example: Click here to see an example of how to use put_messages API.
-
update_message
(queue_id, message_receipt, update_message_details, **kwargs)¶ Updates the visibility of the message represented by the receipt. You must use the messages endpoint to update messages. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint.Parameters: - queue_id (str) – (required) The unique queue identifier.
- message_receipt (str) – (required) The receipt of the message retrieved from a GetMessages call.
- update_message_details (oci.queue.models.UpdateMessageDetails) – (required) Details for the message to update.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation usesDEFAULT_RETRY_STRATEGY
as default if no retry strategy is provided. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typeUpdatedMessage
Return type: Example: Click here to see an example of how to use update_message API.
-
update_messages
(queue_id, update_messages_details, **kwargs)¶ Updates multiple messages in the queue or the consumer group. Only messages from the same queue/consumer group can be updated at once. You must use the messages endpoint to update messages. The messages endpoint may be different for different queues. Use
get_queue()
to find the queue’s messagesEndpoint.Parameters: - queue_id (str) – (required) The unique queue identifier.
- update_messages_details (oci.queue.models.UpdateMessagesDetails) – (required) Details for the messages to update.
- opc_request_id (str) – (optional) Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- retry_strategy (obj) –
(optional) A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
This should be one of the strategies available in the
retry
module. This operation usesDEFAULT_RETRY_STRATEGY
as default if no retry strategy is provided. The specifics of the default retry strategy are described here.To have this operation explicitly not perform any retries, pass an instance of
NoneRetryStrategy
. - allow_control_chars (bool) – (optional) allow_control_chars is a boolean to indicate whether or not this request should allow control characters in the response object. By default, the response will not allow control characters in strings
Returns: A
Response
object with data of typeUpdateMessagesResult
Return type: Example: Click here to see an example of how to use update_messages API.
-