Skip to content

Servicebus

formatting...

Task performs Azure SerciceBus operations to a specified endpoint.

Step implementations

Arguments

Name Type Description Default
direction RequestDirection if the request is upstream or downstream required
endpoint str specifies details to be able to perform the request, e.g. Service Bus resource, queue, topic, subscription etc. required
name str name used in locust statistics required
destination str not used by this client None
source str file path of local file that should be put on endpoint None

Format

endpoint

sb://[<username>:<password>@]<sbns resource name>[.servicebus.windows.net]/[queue:<queue name>|topic:<topic name>[/subscription:<subscription name>]][/expression:<expression>][;SharedAccessKeyName=<policy name>;SharedAccessKey=<access key>][#[Consume=<consume>][&MessageWait=<wait>][&ContentType<content type>][&Tenant=<tenant>][&Empty=<empty>][&Unique=<unique>][&Verbose=<verbose>][&Forward=<forward>]]

All variables in the endpoint has support for templating.

Network location:

Name Type Description Default
<username> str when using credentials, authenticate with this username None
<password> str password for said user None
<sbns resource name> str must be specfied, Azure Service Bus Namespace name, with or without domain name required

Path:

Name Type Description Default
<queue name> str name of queue, prefixed with queue: of an existing queue required1
<topic name> str name of topic, prefixed with topic: of an existing topic required1
<subscription name> str name of an subscription on topic name, either an existing, or one to be created (if step text containing SQL Filter rule is specified), the actual subscription name will be suffixed with unique id related to the user instance None
<expression> str JSON or XPath expression to filter out message on payload, only applicable when receiving messages None

Query:

Name Type Description Default
<policy name> str name of the Service Bus policy to be used required
<access key> str secret access key for specified policy name required

Fragment:

Name Type Description Default
<consume> bool if messages should be consumed (removed from endpoint), or only peeked at (left on endpoint) True
<wait> int how many seconds to wait for a message to arrive on the endpoint None => ∞
<content type> str content type of response payload, should be used in combination with <expression> None
<tenant> str when using credentials, tenant to authenticate with None
<empty> bool if endpoint should be emptied before each iteration True
<unique> bool if each instance should have their own endpoint, when set to False all instances will share True
<verbose> bool verbose logging for only these requests False
<forward> bool if a queue should be created and the subscription should forward to it, and consuming messages from the queue instead of directly from the subscription False

If <unique> is False, it will not empty the endpoint between each iteration.

If connection strings is to be used for authentication, the following endpoint parts must be present:

  • <policy name>

  • <access key>

If credential is to be used for authentication, the following endpoint parts must be present:

  • <username>

  • <password>

  • <tenant>

Examples

Given value for variable "event" is "none"
Then get from "sb://$conf::sb.name$.servicebus.windows.net/topic:incoming-events/subscription:grizzly-/expression:'$.`this`[?active=true]';SharedAccessKeyName=$conf::sb.key.name$;SharedAccessKey=$conf::sb.key.secret$#Consume=True&MessageWait=$conf::sb.message.wait$&ContentType=json&Forward=True" with name "get-incoming-events" and save response payload in "event"

  1. Mutally exclusive, either specify queue: / <queue name> or topic: / <topic name>, not both