Library version: | 2.0.1 |
---|---|
Library scope: | global |
Named arguments: | supported |
Library for working with RabbitMQ.
pika | https://pypi.org/project/pika/ |
requests | https://pypi.python.org/pypi/requests |
robot framework | http://robotframework.org |
Settings | Value |
Library | RabbitMq |
Library | Collections |
Test Cases | Action | Argument | Argument | Argument | Argument | Argument | |
Simple | |||||||
Create Rabbitmq Connection | my_host_name | 15672 | 5672 | guest | guest | alias=rmq | |
${overview}= | Overview | ||||||
Log Dictionary | ${overview} | ||||||
Close All Rabbitmq Connections |
Keyword | Arguments | Documentation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Binding Exchange With Queue | exchange_name, queue_name, routing_key=, arguments=None | Create binding of exchange with queue. Args: exchange_name - exchange name; queue_name - queue name; routing_key - routing key; arguments - additional arguments in dictionary format; Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Channels | List of open channels. Returns: List of open channels in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Close All Rabbitmq Connections | Close all RabbitMq connections. This keyword is used to close all connections only in case if there are several open connections. Do not use keywords Disconnect From Rabbitmq and Close All Rabbitmq Connections together. After this keyword is executed the index returned by Create Rabbitmq Connection starts at 1. Example:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Connections | List of open connections. Returns: List of open connections in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Create Exchange | exchange_name, exchange_type, auto_delete=None, durable=None, arguments=None | Create exchange. The parameter arguments is passed as dictionary. When defining "alternate-exchange" argument in the dictionary it is necessary to pass exchange's alternative name (if message cannot be routed it will be sent to alternative exchange). Args: exchange_name - exchange name; exchange_type - exchange type (direct, topic, headers, fanout); auto_delete - delete exchange when all queues finish working with it (true, false); durable - exchange survives when broker restarts (true, false); arguments - additional arguments in dictionary format; Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Create Queue | queue_name, auto_delete=None, durable=None, node=None, arguments=None | Create queue. Args: queue_name - queue name (quoted with requests.utils.quote); auto_delete - delete queue when last subscriber unsubscribes from queue (true, false); durable - queue survives when broker restarts (true, false); node - RabbitMq node name; arguments - additional arguments in dictionary format; Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Create Rabbitmq Connection | host, http_port, amqp_port, username, password, alias, vhost | Connect to RabbitMq server. Args: host - server host name; http_port - port number of http-connection amqp_port - port number of amqp-connection username - user name; password - user password; alias - connection alias; vhost - virtual host name; Returns: Current connection index. Raises: socket.error if connection cannot be created. Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Delete Exchange | exchange_name | Delete exchange. Args: exchange_name - exchange name; Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Delete Queue | queue_name | Delete queue. Args: queue_name - queue name; Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Disconnect From Rabbitmq | Close current RabbitMq connection. Example:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Enable Consuming Messages In Queue | queue_name, count, requeue, consumed_list | Enable consuming messages in queue. Args: queue_name - queue name; count - number of messages to consume; requeue - re-placing consumed message in the queue with setting of redelivered attribute (true, false); consumed_list - list of delivery_tag of all consumed messages; Returns: Identifier of message handler in the queue. Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Enable Message Sending Confirmation | confirmed_list, activate=True | Enable processing of successful message sending confirmation in the exchange servers. If message is successfully sent to confirmed_list, delivery_tag of the message is added. Args: confirmed_list - list in which all the delivery tag of sent messages are saved; activate - indicates that message sending listener should start; Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exchanges | List of exchanges. Returns: List of exchanges in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Example:
=> List length is 8 and it contains following items:
... ${name} = amq.direct | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Binding Exchange With Queue List | exchange_name, queue_name, vhost=%2F | Get information about bindings of exchange with queue. Parameters are quoted with requests.utils.quote. Args: exchange_name - exchange name; queue_name - queue name; vhost - virtual host name (quoted with requests.utils.quote); Returns: List of bindings of exchange with queue in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Example:
=> Dictionary size is 7 and it contains following items:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Exchange | exchange_name, vhost=%2F | Get information about exchange. Parameters are quoted with requests.utils.quote. Args: exchange_name - exchange name; vhost - virtual host name; Returns: Dictionary with information about exchange. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Example:
=> Dictionary size is 9 and it contains following items:
${value} = testExchange | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Exchanges On Vhost | vhost=%2F | List of exchanges on virtual host. Returns: List of exchanges in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Args: vhost - virtual host name (quoted with requests.utils.quote); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Message | queue_name, count, requeue, encoding, truncate=None, vhost=%2F, ackmode=ack_requeue_true | Get message from the queue. Args: queue_name - queue name; count - number of messages to get; requeue - re-placing received message in the queue with setting of redelivered attribute (true, false); encoding - message encoding (auto, base64); truncate - size of the message split (in bytes) in case it is greater than specified parameter (optional); vhost - virtual host name (quoted with requests.utils.quote); ackmode - determines whether the messages will be removed from the queue. If ackmode is ack_requeue_true or reject_requeue_true they will be requeued. If ackmode is ack_requeue_false or reject_requeue_false they will be removed; Returns: List with information about returned messages in dictionary format. Body of the message in the dictionary is "payload" key. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Example:
=> List length is 5 and it contains following items:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Name Of All Connections | List with names of all open connections. Returns: List with names of all open connections. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Names Of All Exchanges | List of names of all exchanges. Returns: List of names of all exchanges. Example:
=> List has one item: amq.direct | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Names Of Exchanges On Vhost | vhost=%2F | List of exchanges names on virtual host. Args: vhost: virtual host name (quoted with requests.utils.quote); Returns: List of exchanges names. Example:
=> List has one item: federation: ex2 -> rabbit@server.net.ru | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Names Of Queues On Vhost | vhost=%2F | List of queues names on virtual host. Args: vhost: virtual host name (quoted with requests.utils.quote); Returns: List of queues names. Example:
=> List has one item: federation: ex2 -> rabbit@server.net.ru | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Queue | queue_name, vhost=%2F | Get information about queue. Parameters are quoted with requests.utils.quote. Args: queue_name - queue name; vhost - virtual host name (quoted with requests.utils.quote); Returns: Dictionary with information about queue. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Example:
=> Dictionary size is 23 and it contains following items:
${value} = testQueue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Get Queues On Vhost | vhost=%2F | List of queues on virtual host. Args: vhost - virtual host name (quoted with requests.utils.quote); Returns: List of queues in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Is Alive | Rabbitmq health check. Sends GET-request : 'http://<host>:<port>/api/' and checks response status code. Returns: bool True if return code is 200. bool False in all other cases. Raises: RequestException if it is not possible to send GET-request. Example:
=> True | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Is Exchange Exist | name, exchange_type | Check if exchange exists Args: name - exchange name; exchange_type - exchange type; Example:
Returns: True if exchange exists otherwise False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Is Queue Exist | name | Check if queue exists Args: name - queue name Example:
Returns: True if queue exists otherwise False | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Nodes | List of nodes. Returns: List of nodes in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Overview | Information about RabbitMq server. Returns: Dictionary with information about the server. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. Example:
=> Dictionary size is 14 and it contains following items:
${version} = 3.3.0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Process Published Message In Queries | waiting=1 | Send processing of published message in queues to handler. May end with exception if handler is not installed or there are no messages in queue. Args: waiting - server response timeout. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Publish Message | exchange_name, routing_key, payload, props=None | Publish message to the queue. Args: exchange_name - exchange name; routing_key - routing key (quoted with requests.utils.quote); payload - payload message; props - additional arguments in dictionary format; Includes such keys as:
Attention: When using library in robot-files parameters (props) must be cast to the correct type. Example:
This is due to the feature of RabbitMq library. Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Purge Queue | queue_name | Purge queue. Args: queue_name - queue name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Queues | List of queues. Returns: List of queues in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Switch Rabbitmq Connection | alias | Switch between active RabbitMq connections using their index or alias. Alias is set in keyword Create Rabbitmq Connection which also returns the index of connection. Args: alias - connection alias; Returns: Index of previous connection. Example:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unbind Queue | queue_name, exchange_name, routing_key=, arguments=None | Unbind queue from exchange. Args: queue_name - queue name; exchange_name - exchange name; routing_key - routing key; arguments - additional arguments in dictionary format; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Vhosts | List of virtual hosts. Returns: List of virtual hosts in JSON format. Raises: raise HTTPError if the HTTP request returned an unsuccessful status code. |