Knowledge Base Administration Guide

Tunnel Test messages, using rabbitmqadmin

The Tunnel can be tested from the command-line.

RabbitMQ comes with a Management CLI Tool called rabbitmqadmin that can be used to post messages from the command-line. (If curious, this script is actually Python code.)

rabbitmqadmin documentation

rabbitmqadmin has a builtin help command, which documents its parameters.

> rabbitmqadmin help subcommands

Here is the help for publishing:

Publishing and Consuming
========================

  publish routing_key=... [exchange=... payload=... payload_encoding=... properties=...]
  get queue=... [count=... payload_file=... ackmode=... encoding=...]

  * If payload is not specified on publish, standard input is used

  * If payload_file is not specified on get, the payload will be shown on
    standard output along with the message metadata

  * If payload_file is specified on get, count must not be set

Example Regression Start

Example Tunnel message publish for a direct queue configuration:

Write the following to a file cpu_smoke.json:

{
    "name": "cpu_smoke/12.4",
    "component": "alpha_cpu_core",
    "project": "alpha",
    "model_branch": "dev",
    "model_version": "46fa3f7483ef06801a94c6b24c108fa2",
    "model_timestamp": "2020-02-03T12:00:54Z",
    "queue": "queue3",
    "pending": true,
    "userid": "admin",
    "host": "c-2",
    "command": "flow --regr --seed 6801a9 MODEL=1a4",
    "dir": "/mnt/proj/regr/nightly/12.4",
    "integrate": false,
    "starttime": "2020-02-05T22:00:53.842443Z"
}

Test Publish via rabbitmqadmin

Then run this command to publish the JSON via rabbitmqadmin:

# Note: replace these variables:
# - RABBIT_HOST
# - RABBIT_USERNAME
# - RABBIT_PASSWORD
# - TUNNEL_INPUT_QUEUE (e.g. tunnel-in)

$ rabbitmqadmin publish --host=RABBIT_HOST --username=RABBIT_USERNAME --password=RABBIT_PASSWORD \
routing_key=TUNNEL_INPUT_QUEUE properties='{"correlation_id": "cpu_smoke/12.4", "type": "regr-start"}' < cpu_smoke.json
  • Notes for above variables:
KeyValue
Rabbit Hostlocalhost, rmq, etc.
Rabbit UsernameUSERNAME
Rabbit PasswordPASSWORD
Tunnel Input Queuetunnel-in

JSON Response

If the message was published from rabbitmqadmin, you should see this on the terminal:

Message published

If the Tunnel and Simscope have been configured successfully, you will see two messages (one in the Tunnel terminal and another in the Simscope terminal):

  1. The Tunnel stdout will print a message similar to:
2020-02-07 19:00:59 [INFO ] Tunnel pass-through tag=1 type=regr-start regr=cpu_smoke/123 routingkey=tunnel-in
  1. Simscope stdout will print a message similar to:
2020-02-07 19:01:17 [INFO ] Rabbit start  regr=cpu_smoke/12.4 branch=dev

JSON Publish Errors

If you see this message:

*** Access refused: /api/exchanges/%2F/amq.default/publish
  • Then your Rabbit username and/or password are incorrrect.

If you see this message:

Message published but NOT routed
  • This indicates your RabbitMQ queue name is incorrect.