Skip to content
axxbetadocs
GitHub

Pub/Sub

View .mdOpen in Claude

Publish messages to Pub/Sub topics and check the messages your services publish.

The steps use the scenario’s project (the {word} gcp project with the following properties:, from gcp-core).

Checking a topic does not take messages from anyone: for the topics a run checks, Axx creates a subscription of its own (axx-<run>-<topic>) once the apps are up, and deletes it when the run ends. A check only looks at the messages received since its scenario started; match on data unique to the scenario, since scenarios run in parallel. The conditions are paths into the message data (JSON) and attribute <name> rows for its attributes.

When a message is published to the {word} pubsub topic:
"""
...
"""

Send a message whose body is the doc string to a pubsub topic.

Parameters: {word} (one word, no spaces)

Example:

When a message is published to the invoice-events pubsub topic:

Since 0.1.0.

When the {filepath} message is published to the {word} pubsub topic[[ with the following attributes:]]

Send a message whose body is the file (resolved against resources) to a pubsub topic, with the attributes of the table (name | value).

Variants (optional parts in [[...]] above):

  • the {filepath} message is published to the {word} pubsub topic
  • the {filepath} message is published to the {word} pubsub topic with the following attributes:

Parameters: {filepath} (A file of the project, without whitespace: a path relative to the resources directories or to the directory of axx.yaml, or an absolute path. Editors link it to the file), {word} (one word, no spaces)

Example:

When the messages/shipment-delivered.json message is published to the invoice-events pubsub topic
When the messages/shipment-delivered.json message is published to the invoice-events pubsub topic with the following attributes:

Since 0.1.0.

Then [[within {duration} ]]the {word} pubsub topic has a message where:
| ... | ... |

Wait (10s, or the given time) until the pubsub topic has a message, received since the scenario started, that meets every row: path | value on the JSON body (a field name, a dotted path or a JSONPath, compared as text; null for null and undefined for absent), or attribute <name> | value on a attribute sent with it. Axx creates a subscription of its own to the topic for the run.

Variants (optional parts in [[...]] above):

  • the {word} pubsub topic has a message where:
  • within {duration} the {word} pubsub topic has a message where:

Parameters: {duration} (A duration in seconds or minutes, e.g. 5s or 2m), {word} (one word, no spaces)

Example:

Then within 30s the invoice-events pubsub topic has a message where:

Since 0.1.0.