amqp-exec

command
v0.1.36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2020 License: MIT Imports: 15 Imported by: 0

README

amqp-exec

It's like CGI but for AMQP protocol:

  1. Listening for message from broker as amqp-recv
  2. Executes application initially defined by arguments. The app STDIN mapped to message body.
  3. Wait for finish
  4. If exit code is not 0 then requeue back to AMQP broker with some delay
  5. Otherwise if REPLY_TO property defined sends full STDOUT to corresponded REPLY_TO routing key and correlation id
  6. If no reply-to defined in the envelope, send to default destination (pub-* params) in case if publishing key is defined (pub-key)

Note: you may pass -- before positional arguments to prevent interference with arguments of amqp-exec itself.

Environment during execution

Name Value
MESSAGE_ID Message ID from AMQP envelope
MESSAGE_TYPE Message type from envelope
CONTENT_TYPE Content type as defined in an AMQP envelope
SUBJECT Routing key
TIMESTAMP Timestamp in UNIX (seconds) as defined in envelope
CORRELATION_ID Correlation from the envelope

Envelope headers also added as-is to environment.

Usage

Usage:
  amqp-exec [OPTIONS] [application] [params...]

Application Options:
  -u, --url=                                    One or more AMQP brokers urls (default: amqp://guest:guest@localhost) [$BROKER_URL]
  -e, --exchange=                               Name of AMQP exchange. Can be empty [$BROKER_EXCHANGE]
  -k, --kind=[direct|topic|fanout]              Exchange kind (default: direct) [$BROKER_KIND]
  -s, --verify-public-cert=                     Path to public cert to verify [$BROKER_SIGN]
  -Q, --queue=                                  Queue name or empty for autogenerated [$BROKER_QUEUE]
  -l, --lazy                                    Make queue lazy (prefer keep data on disk) [$BROKER_LAZY]
  -R, --reconnect-interval=                     Reconnect timeout (default: 5s) [$BROKER_RECONNECT_INTERVAL]
      --retry-limit=                            Number of retries (-1 is infinite) (default: -1) [$RETRY_LIMIT]
      --retry-interval=                         Delay between attempts (default: 5s) [$RETRY_INTERVAL]
  -T, --timeout=                                Connect timeout (default: 30s) [$BROKER_CONNECT_TIMEOUT]
  -q, --quiet                                   Suppress all log messages [$BROKER_QUIET]
  -v, --version                                 Print version and exit
  -r, --routing-key=                            Routing key [$BROKER_ROUTING_KEY]
  -E, --pub-exchange=                           Default publishing exchange [$PUB_EXCHANGE]
  -K, --pub-exchange-type=[direct|topic|fanout] Default publishing exchange type (default: direct) [$PUB_EXCHANGE_TYPE]
  -U, --pub-key=                                Default publishing key [$PUB_KEY]
      --pub-empty                               Allow publish empty messages [$PUB_EMPTY]
  -H, --pub-header=                             Custom headers that should be added to the output message [$PUB_HEADER]
  -M, --multiline                               Use each line of output as single message [$MULTILINE]

Help Options:
  -h, --help                                    Show this help message

Additional headers should be defined in format: KEY1:VALUE1,KEY2:VALUE2 and so on.

Example:

  • amqp-exec -Q qwe -- date --rfc-3339=seconds generates current date time in RFC339 with seconds precision

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL