qpid_bow.management package

Submodules

qpid_bow.management.connection module

AMQP broker connection management.

qpid_bow.management.connection.get_connection_ids(server_url: Optional[str] = None) → list

Retrieve connection ids of all established connections to AMQP broker.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:List of connections
qpid_bow.management.connection.kill_connection(connection_id: dict, server_url: Optional[str] = None)

Kill connection on AMQP broker.

Parameters:
  • connection_id – ID of connection.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.

qpid_bow.management.exchange module

AMQP broker exchange management.

class qpid_bow.management.exchange.ExchangeType

Bases: enum.Enum

Define type of exchange.

direct = 'direct'
fanout = 'fanout'
headers = 'headers'
topic = 'topic'
qpid_bow.management.exchange.create_binding(exchange_name: str, queue_name: str, binding_name=None, headers_match: dict = None, server_url: Optional[str] = None)

Create binding between queue and exchange.

Parameters:
  • exchange_name – Name of exchange.
  • queue_name – Name of queue.
  • binding_name – Name of binding.
  • headers_match – Headers key-value pairs that should be presented on message to match the binding. Only for headers exchange type.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.exchange.create_exchange(exchange_name: str, exchange_type: qpid_bow.management.exchange.ExchangeType = <ExchangeType.direct: 'direct'>, durable: bool = True, server_url: Optional[str] = None)

Create an exchange on the broker.

Parameters:
  • exchange_name – Exchange name.
  • exchange_typedirect, topic, fanout, headers.
  • durable – Persist the created exchange on broker restarts.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.exchange.delete_binding(exchange_name: str, queue_name: str, binding_name: str = None, server_url: Optional[str] = None)

Delete a binding on the broker.

Parameters:
  • exchange_name – Name of exchange.
  • queue_name – Name of queue.
  • binding_name – Name of binding.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.exchange.delete_exchange(exchange_name: str, server_url: Optional[str] = None)

Delete an exchange on the broker.

Parameters:
  • exchange_name – Exchange name.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.exchange.get_binding_keys(exchange_name: str, queue_name: str = None, server_url: Optional[str] = None) → Set[Tuple[str, str, str]]

Retrieve all bindings for specified exchange.

Parameters:
  • exchange_name – Name of exchange.
  • queue_name – Name of queue.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:

Set of binding keys.

qpid_bow.management.exchange.get_exchange_bindings(server_url: Optional[str] = None) → dict

Retrieve all exchanges and bindings associated with these exchanges.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:A dict mapping between exchange it’s bindings.
Return type:dict

Example

>>> get_exchange_bindings()
{'org.apache.qpid.broker:exchange:': [{'queue_id': 'org.apache.qpid.broker:queue:examples', 'headers_match': {}}]}
qpid_bow.management.exchange.get_headers_binding_name(exchange: str, queue_name: str, headers_match: dict)

Generate UUID for exchange, queue and binding.

Parameters:
  • exchange – Name of exchange.
  • queue_name – Name of queue.
  • headers_match – Headers key-value pairs that should be presented on message to match the binding. Only for headers exchange type.
Returns:

UUID generated based on specified arguments.

qpid_bow.management.queue module

AMQP broker queue management.

qpid_bow.management.queue.create_queue(queue_name: str, durable: bool = True, auto_delete: bool = False, priorities: int = 0, extra_properties: Optional[dict] = None, server_url: Optional[str] = None)

Create a queue on the AMQP broker.

Parameters:
  • queue_name – Name of queue.
  • durable – Persist the created queue on broker restarts.
  • auto_delete – Delete queue after consumer is disconnected from broker.
  • priorities – The number of priorities to support.
  • extra_properties – Additional properties that will be added during queue creation.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.queue.delete_queue(queue_name: str, server_url: Optional[str] = None)

Delete a queue on the AMQP broker.

Parameters:
  • queue_name – Name of queue.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.queue.purge_queue(queue_name: str, limit: int = 0, message_filter: Optional[Tuple[str, str]] = None, server_url: Optional[str] = None)

Purge a queue on the AMQP broker.

Parameters:
  • queue_name – Name of queue.
  • limit – Limit the amount of messages to purge.
  • message_filter – Filter based on property=value.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
qpid_bow.management.queue.reroute_queue(queue_name: str, exchange_name: str, limit: int = 0, message_filter: Optional[Tuple[str, str]] = None, server_url: Optional[str] = None)

Reroute messages from a queue to an exchange.

Parameters:
  • queue_name – Name of queue.
  • exchange_name – Name of exchange.
  • limit – Limit the amount of messages to reroute.
  • message_filter – Filter based on property=value.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.

qpid_bow.management.session module

Gather session-related data from AMQP broker.

qpid_bow.management.session.get_outgoing_sessions_by_address(server_url: Optional[str] = None) → MutableMapping[str, list]

Retrieve outgoing sessions from AMQP broker.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:A dict mapping between address name and list of sessions.
Return type:defaultdict

Example

>>> get_outgoing_sessions_by_address()
{'8152f68b-c74a-4d22-8630-a89cf194d067_8152f68b-c74a-4d22-8630-a89cf194d067-2d808664-fe81-4da4-8258-288a7ff531ac': [{'session_id': 'org.apache.qpid.broker:session:0x7fb8bc021ab0','transfers': ulong(0)}]}
qpid_bow.management.session.get_sessions(server_url: Optional[str] = None) → dict

Retrieve sessions from AMQP broker.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:A dict mapping between session id and it’s address.
Return type:dict

Example

>>> get_sessions()
{'org.apache.qpid.broker:session:0x7fb8bc021ab0': {'address': '10.0.0.2:34814'}}

qpid_bow.management.statistics module

Gather statistics from AMQP broker.

qpid_bow.management.statistics.exchange_statistics(server_url: Optional[str] = None) → dict

Retrieve total and dropped amount of messages for exchanges from AMQP broker.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:
A dict mapping between exchange address and dict with exchange
name, total messages count and dropped messages count.
Return type:dict

Example

>>> exchange_statistics()
{'org.apache.qpid.broker:exchange:': {'name': '', 'total': ulong(236), 'dropped': ulong(0)}}
qpid_bow.management.statistics.gather_statistics(server_url: Optional[str] = None) → dict

Retrieve statistics about exchanges and queues from AMQP broker.

Statistics data includes exchanges and queues. Exchange information includes exchange name, total and dropped amount of messages. Queue information includes messages count, depth and bindings to exchange.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:Exchange and queue statistics.
Return type:dict

Example

>>> gather_statistics()
{'exchanges': {'org.apache.qpid.broker:exchange:': {'dropped': ulong(0), 'name': '', 'total': ulong(251)}}, 'queues': {'org.apache.qpid.broker:queue:examples': {'bindings': [{'exchange_id': 'org.apache.qpid.broker:exchange:', 'name': 'default_route', 'total': 96}], 'depth': 12, 'name': 'examples', 'total': 96}}}
qpid_bow.management.statistics.queue_statistics(queue_name: Optional[str] = None, include_autodelete: bool = False, server_url: Optional[str] = None) → dict

Retrieve total messages count and depth for all queues from AMQP broker.

Parameters:
  • queue_name – Name of queue.
  • include_autodelete – Include autodelete queues to output.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:

A dict mapping between queue address and dict with total messages and queue depth.

Return type:

dict

Example

>>> queue_statistics(queue_name='examples')
{'org.apache.qpid.broker:queue:examples': {'name': 'examples', 'total': 96, 'depth': 12}}

Module contents

qpid_bow.management.create_QMF2_message() → proton._message.Message

Factory function to create a base message for a QMF2 RPC call.

Returns:A base message for a QMF2 RPC call.
Return type:Message
qpid_bow.management.create_QMF2_method_invoke(object_id: dict, method_name: str, arguments: Mapping[str, Any]) → proton._message.Message

Factory function to create a QMF2 object method call.

Parameters:
  • object_id – Qpid internal object ID.
  • method_name – Name of the method to call.
  • arguments – Mapping with key/value pairs of arguments for the method.
Returns:

A message fully setup with a QMF2 method invoke RPC call.

Return type:

Message

qpid_bow.management.create_QMF2_query(package_name: str, class_name: str) → proton._message.Message

Factory function to create a QMF2 object query.

Parameters:
  • package_name – Qpid internal package name to query.
  • class_name – Qpid internal class name to query.
Returns:

A message fully setup with a QMF2 object query RPC call.

Return type:

Message

qpid_bow.management.get_broker_id(server_url: Optional[str] = None) → dict

Get the full internal broker ID object.

Parameters:server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:Full internal broker ID object.
Return type:dict
qpid_bow.management.get_object(package_name: str, class_name: str, object_name: str, server_url: Optional[str] = None) → dict

Find a raw QMF2 object by type and name.

Parameters:
  • package_name – Qpid internal package name to query.
  • class_name – Qpid internal class name to query.
  • object_name – Name of the Qpid object to find.
  • server_url – Comma-separated list of urls to connect to. Multiple can be specified for connection fallback, the first should be the primary server.
Returns:

Raw QMF2 object.

Return type:

dict

qpid_bow.management.handle_QMF2_exception(message: proton._message.Message)

Deserialises and raises a QMF2 exception from a reply, in case the QMF2 RPC call failed.

Parameters:message – The QMF2-RPC reply message.