Note that for simplicity, `amqtt_pub` uses mostly the same argument syntax as [mosquitto_pub](http://mosquitto.org/man/mosquitto_pub-1.html).
## Options
-`--version` - amqtt version information
-`-h, --help` - Display `amqtt_pub` usage help
-`-c` - Set the YAML configuration file to read and pass to the client runtime.
-`-d` - Enable debugging information.
-`--ca-file` - Define the path to a file containing PEM encoded CA certificates that are trusted. Used to enable SSL communication.
-`--ca-path` - Define the path to a directory containing PEM encoded CA certificates that are trusted. Used to enable SSL communication.
-`--ca-data` - Set the PEM encoded CA certificates that are trusted. Used to enable SSL communication.
-`--clean-session` - If given, set the CONNECT clean session flag to True.
-`-f` - Send the contents of a file as the message. The file is read line by line, and `amqtt_pub` will publish a message for each line read.
-`-i` - The id to use for this client. If not given, defaults to `amqtt_pub/` appended with the process id and the hostname of the client.
-`-l` - Send messages read from stdin. `amqtt_pub` will publish a message for each line read. Blank lines won't be sent.
-`-k` - Set the CONNECT keep alive timeout.
-`-m` - Send a single message from the command line.
-`-n` - Send a null (zero length) message.
-`-q, --qos` - Specify the quality of service to use for the message, from 0, 1 and 2. Defaults to 0.
-`-s` - Send a message read from stdin, sending the entire content as a single message.
-`-t` - The MQTT topic on which to publish the message.
-`--url` - Broker connection URL, conforming to [MQTT URL scheme](https://github.com/mqtt/mqtt.github.io/wiki/URI-Scheme).
-`--will-topic` - The topic on which to send a Will, in the event that the client disconnects unexpectedly.
-`--will-message` - Specify a message that will be stored by the broker and sent out if this client disconnects unexpectedly. This must be used in conjunction with `--will-topic`.
-`--will-qos` - The QoS to use for the Will. Defaults to 0. This must be used in conjunction with `--will-topic`.
-`--will-retain` - If given, if the client disconnects unexpectedly the message sent out will be treated as a retained message. This must be used in conjunction with `--will-topic`.
-`--extra-headers` - Specify a JSON object string with key-value pairs representing additional headers that are transmitted on the initial connection, but only when using a websocket connection
## Configuration
If `-c` argument is given, `amqtt_pub` will read specific MQTT settings for the given configuration file. This file must be a valid [YAML](http://yaml.org/) file which may contain the following configuration elements:
*`keep_alive`: Keep-alive timeout sent to the broker. Defaults to `10` seconds.
*`ping_delay`: Auto-ping delay before keep-alive timeout. Defaults to 1. Setting to `0` will disable to 0 and may lead to broker disconnection.
*`default_qos`: Default QoS for messages published. Defaults to 0.
*`default_retain`: Default retain value to messages published. Defaults to `false`.
*`auto_reconnect`: Enable or disable auto-reconnect if connection with the broker is interrupted. Defaults to `false`.
*`reconnect_retries`: Maximum reconnection retries. Defaults to `2`. Negative value will cause client to reconnect infinitely.
*`reconnect_max_interval`: Maximum interval between 2 connection retry. Defaults to `10`.
## Examples
Examples below are adapted from [mosquitto_pub](http://mosquitto.org/man/mosquitto_pub-1.html) documentation.