This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

A simple CLI tool for sending amqp messages to exchanges.

What is the purpose of amqp-client-cli?

The purpose of this command line tool is to make sending messages to exchanges as simple as possible. Uses include:

  • In cron scripts that periodically send simple messages to an ampq server for workers to pick up.
  • Unit testing during implementation of an amqp system into a workflow.
  • Simple one-off queue messages where anything more than a simple command line tool is a hassle to use.

What does amqp-client-cli not do?

This tool is not intended for configuration. It assumes your entire infrastructure is already in place. It can only send to existing exchanges and vhosts and provide a routing key.

It is up to you to configure your infrastructure elsewhere before using this tool (i.e. through your queue workers, through something like rabbitmqadmin, through a web management console. etc).

How do I get it?

Install via pip:

pip install amqp_client_cli

How do I use it?

amqp-client-cli is run via the amqpcli command. Run the help subcommand to see the list of options:

$ amqpcli help
amqpcli: A command line interface for interacting with amqp exchanges

Usage: amqpcli {{options}} {{subcommand}}

Options:
  -h, --help     Show this help message and exit
  -n, --nocolor  Do not colorize output

Subcommands:
  config  Configure the amqpcli client
  send    Send a message to an exchange

Let’s send a message!

Sending messages can be done using the amqpcli send command.

amqpcli send: Send a message to an exchange

Usage: send {{arguments}} {{options}}

Arguments:
  host [text]         Address of the amqp server
  port [int]          Port of the amqp server
  exchange [text]     Name of the exchange being sent to
  routing_key [text]  The routing key for the message

Options:
  -h, --help              Show this help message and exit
  -m, --message [text]    String to use as the message body
  -f, --file-path [text]  Path of a file to use as the message body
  -p, --persistent        Make the message persistent if routed to a durable queue
  -s, --ssl               Use ssl/tls as the connection protocol
  -u, --user [text]       User to connect to the queue as
  -v, --vhost [text]      The vhost to connect to
  -n, --nocolor           Do not colorize output

Let’s assume we have a RabbitMQ server listening at localhost:5671 with an exchange we would like to send a message to named exchange_a on a vhost my_vhost with a routing key of simple_message. We are going to send via the guest user.

Let’s define our message on the command line!

$ amqpcli send localhost 5671 exchange_a simple_message -m "Hello there" -v my_vhost -s
User: guest
Password:
Connecting to queue @ localhost:5671... SUCCESS!
Message successfully published to exchange [exchange_a]!

Let’s define our message as a file!

The message body can also be a file. It will be interpreted as binary.

Warning: Although any binary content can be sent, it is not recommended to insert large payloads into the queue for performance reasons.

$ echo "I'm a message in a file" > my_message.txt
$ amqpcli send localhost 5671 exchange_a simple_message -f my_message.txt -v my_vhost -s
User: guest
Password:
Connecting to queue @ localhost:5671... SUCCESS!
Message successfully published to exchange [exchange_a]!

How can I specify credentials/configurations for a script?

You can optionally add user credentials to a config file for use with the tool (~/.amqpclirc). There is no limit to the number of users that can be added.

Configuration options can be seen from the command line.

amqpcli config: Configure the amqpcli client

Usage: config {{options}} {{subcommand}}

Options:
  -h, --help     Show this help message and exit
  -n, --nocolor  Do not colorize output

Subcommands:
  add_user     Add a new queue user
  delete_user  Remove an existing queue user

With add_user, you will be prompted for a username, password, and vhost (default is /).

A user can also be specified in the environment variables by defining AMQP_USER, AMQP_PASSWORD, and AMQP_VHOST.

$ amqpcli config add_user
User: guest
Password:
vhost? [/]: my_vhost
$ amqpcli send localhost 5671 exchange_a simple_message -m "Hello there" -u guest
Connecting to queue @ localhost:5671... SUCCESS!
Message successfully published to exchange [exchange_a]!
Release History

Release History

0.2.post3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.post2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
amqp_client_cli-0.2.post3.tar.gz (21.6 kB) Copy SHA256 Checksum SHA256 Source Apr 23, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting