libsolace.items.SolaceQueue module¶
-
class
libsolace.items.SolaceQueue.
SolaceQueue
[source]¶ Manage a Solace Queue
This plugin manages Queues within Solace. Typically you should invoke this plugin via L{SolaceAPI.SolaceAPI}.
Please see L{plugin.Plugin} for how plugins are instantiated and used.
-
consume
(*args, **kwargs)[source]¶ Sets consume permission. add consume kwarg to allow non-owner users to consume.
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- consume (str) – set to “all” to allow ALL appliance client-users to “consume”
Return type: Returns: single SEMP request
Deprecated since version 2.0: Use
permission()
instead.Example:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").consume(queue_name="testqueue1", vpn_name="dev_testvpn", shutdown_on_apply=True, consume="all") >>> # response = api.rpc(request) ""
-
create_queue
(*args, **kwargs)[source]¶ Create a queue / endpoint only if it doesnt exist.
Parameters: - queue_name (str) – the queue name
- vpn_name (str) – the vpn name
Type: plugin.PluginResponse
Returns: single SEMP request
Example 1: Create Request, then Execute
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").create_queue(vpn_name="dev_testvpn", queue_name="my_test_queue") >>> # response = api.rpc(request)
-
defaults
= {'retries': 0, 'consume': 'all', 'exclusive': 'true', 'max_bind_count': 1000, 'queue_size': 1024, 'owner': 'default'}¶
-
enable
(*args, **kwargs)[source]¶ Enable a the queue
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").enable(queue_name="testqueue1", vpn_name="dev_testvpn") >>> # response = api.rpc(request)
-
exclusive
(*args, **kwargs)[source]¶ Set queue exclusivity
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- exclusive (bool) – state
Return type: Returns: single SEMP request
Example: Shutdown, Set Exclusive, Start
>>> api = SolaceAPI("dev") >>> requests = [] >>> requests.append(api.manage("SolaceQueue").shutdown_ingress(queue_name="testqueue1", vpn_name="dev_testvpn", shutdown_on_apply=True)) >>> requests.append(api.manage("SolaceQueue").exclusive(queue_name="testqueue1", vpn_name="dev_testvpn", exclusive=False, shutdown_on_apply=True)) >>> requests.append(api.manage("SolaceQueue").enable(queue_name="testqueue1", vpn_name="dev_testvpn", shutdown_on_apply=True)) >>> # [api.rpc(x) for x in requests]
-
get
(**kwargs)[source]¶ Fetch a queue from the appliance
Parameters: - queue_name (str) – Queue name or filter
- vpn_name (str) – name of the VPN
Return type: Returns: the queue(s)
Examples:
>>> api = SolaceAPI("dev") >>> list_queues = api.manage("SolaceQueue").get(queue_name='*', vpn_name='dev_testvpn')
-
get_queue_config
(queue, **kwargs)[source]¶ Returns a queue config for the queue and overrides where neccessary
Parameters: queue – single queue dictionary e.g. {
“name”: “foo”, “env”: [- “qa1”: {
- “queue_config”: {
- “retries”: 0, “exclusive”: “false”, “queue_size”: 1024, “consume”: “all”, “max_bind_count”: 1000, “owner”: “dev_testuser”
}
}
]
}
-
max_bind_count
(*args, **kwargs)[source]¶ Limit the max bind count
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- max_bind_count (int) – max bind count
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> requests = api.manage("SolaceQueue").max_bind_count(vpn_name="dev_testvpn", queue_name="testqueue1", max_bind_count=50) >>> # response = api.rpc(requests)
-
owner
(*args, **kwargs)[source]¶ Set the owner
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- owner (str) – the owner client-username
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> requests = [] >>> requests.append(api.manage("SolaceQueue").shutdown_ingress(queue_name="testqueue1", vpn_name="dev_testvpn", shutdown_on_apply=True)) >>> requests.append(api.manage("SolaceQueue").shutdown_egress(queue_name="testqueue1", vpn_name="dev_testvpn", shutdown_on_apply=True)) >>> requests.append(api.manage("SolaceQueue").owner(vpn_name="dev_testvpn", queue_name="testqueue1", owner_username="dev_testproductA")) >>> requests.append(api.manage("SolaceQueue").enable(queue_name="testqueue1", vpn_name="dev_testvpn")) >>> # [api.rpc(x) for x in requests]
-
permission
(*args, **kwargs)[source]¶ Sets permission on a queue
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- permission (str) – which permission to grant non-owner users. e.g. “consume”, “delete”, “modify-topic”, “read-only”
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").permission(queue_name="testqueue1", vpn_name="dev_testvpn", shutdown_on_apply=True, permission="consume") >>> # api.rpc(request)
-
plugin_name
= 'SolaceQueue'¶
-
reject_on_discard
(*args, **kwargs)[source]¶ Reject to sender on discard
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").reject_on_discard(vpn_name="dev_testvpn", queue_name="testqueue1") >>> # response = api.rpc(request)
-
retries
(*args, **kwargs)[source]¶ Delivery retries before failing the message
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- retries (int) – number of retries
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").retries(vpn_name="dev_testvpn", queue_name="testqueue1", retries=5) >>> # response = api.rpc(request)
-
shutdown_egress
(*args, **kwargs)[source]¶ Shutdown egress for a queue
Parameters: - shutdown_on_apply (char or bool) – is shutdown permitted boolean or char
- vpn_name (str) – name of the vpn
- queue_name (str) – name of the queue
Return type: Returns: single SEMP request
Example 1: One Shot
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").shutdown_egress(shutdown_on_apply=True, vpn_name="dev_testvpn", queue_name="testqueue1") >>> # response = api.rpc(request)
Example 2: Create Request, then Execute
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").shutdown_egress(shutdown_on_apply=True, vpn_name="dev_testvpn", queue_name="testqueue1") >>> # response = api.rpc(request)
-
shutdown_ingress
(*args, **kwargs)[source]¶ Shutdown the ingress of a queue
Parameters: - shutdown_on_apply (char or bool) – is shutdown permitted boolean or char
- vpn_name (str) – name of the vpn
- queue_name (str) – name of the queue
Return type: Returns: single SEMP request
Example 1: Instant Execution:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").shutdown_ingress(shutdown_on_apply=True, vpn_name="dev_testvpn", queue_name="testqueue1") >>> # response = api.rpc(request)
Example 2: Create Request, then Execute
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").shutdown_ingress(shutdown_on_apply=True, vpn_name="dev_testvpn", queue_name="testqueue1") >>> # api.rpc(request)
-
spool_size
(*args, **kwargs)[source]¶ Set the spool size
Parameters: - vpn_name (str) – the name of the vpn
- queue_name (str) – the queue name
- queue_size (int) – size of the spool in mb
Return type: Returns: single SEMP request
Example:
>>> api = SolaceAPI("dev") >>> request = api.manage("SolaceQueue").spool_size(vpn_name="dev_testvpn", queue_name="testqueue1", queue_size=64) >>> # response = api.rpc(request)
-