CLI that provides fluent and easy wrapper over streadway-amqp API.
777
Library that provides fluent and easy wrapper over streadway-amqp API. Adds such features like:
Hash algorithm (x509) SHA512 with RSA, sign - SHA512.
The signer (producer) should use private key to sign content of message body and message id.
The validator (consumer) should use public certificate to validate content of message and message id against signature and should drops invalid or duplicated messages.
The sign should be put to a header (X-Signature by default: see DefaultSignatureHeader constant in godoc) as binary object (not hex or base64 encoded).
DATA = BYTES(ID) ... BYTES(BODY)
# SIGN via PKCS#1 v1.5
SIGN_HEADER_BODY = SIGN_SHA512(PRIVATE_KEY, DATA)
Message by default has:
amqp-recv supports templating output -o template. Template content read from STDIN.
Root template object is a amqp.Delivery with functions from Sprig plus additional methods like:
asText - converts bytes to stringPrint same as -o plain.
echo '{{- .Body | asText -}}' | amqp-recv -o template ...
Use combination of basic CLI utils and templates.
TOKEN="xxxyyyy" # BotFather token for Telegram (see here: https://t.me/BotFather)
CHAT_ID="1234567" # Target Telegram chat ID (find yours: https://t.me/MyTelegramID_bot)
QUEUE="notification" # queue name should be defined if persistent required
EXCHANGE="amqp.topic" # source of notification
TYPE="topic" # exchange type
TOPIC="#" # specify subject that will be sent over telegram (# - everything)
while true; do
echo -n -e 'Subject: {{.RoutingKey}}\n\n{{.Body | asText}}' | amqp-recv -o template -Q $QUEUE -e $EXCHANGE -k $TYPE "$TOPIC" > message.txt
curl -f -X POST --data "text=$(cat message.txt)" --data "chat_id=${CHAT_ID}" "https://api.telegram.org/bot${TOKEN}/sendMessage" || exit 1
done
cat command)wall command)after installation commands are available with fluent-amqp. prefixes (i.e. fluent-amqp.amqp-exec)
pre-build binaries for all major platform
Content type
Image
Digest
Size
8.4 MB
Last updated
over 6 years ago
docker pull reddec/fluent-amqp:master