Skip to content

runnerty/executor-amqp

Repository files navigation

Smart Processes Management

NPM version Downloads Dependency Status code style: prettier

Executor for Runnerty: AMQP

Module AMQP (Advanced Message Queuing Protocol) 0-9-1 Publisher. This is a wrapper from the amqplib

Installation:

npm i @runnerty/executor-amqp

Configuration:

Add in config.json:

Simple:
{
  "id": "amqp_default",
  "type": "@runnerty-executor-amqp",
  "hostname": "localhost"
}
All parameters:
{
  "id": "amqp_default",
  "type": "@runnerty-executor-amqp",
  "protocol": "amqp",
  "hostname": "localhost",
  "port": 5672,
  "username": "guest",
  "password": "guest",
  "locale": "en_US",
  "frameMax": 1000,
  "heartbeat": 0,
  "vhost": "/",
  "options": {
    "expiration": 10000,
    "userId": "myUserId",
    "CC": "myCC",
    "BCC": ["bcc1,bcc2"],
    "mandatory": false,
    "persistent": true,
    "deliveryMode": true,
    "contentType": "myContentType",
    "contentEncoding": "myContentEncoding",
    "headers": { "header": "value" },
    "priority": 9,
    "correlationId": "myCorrelationId",
    "replyTo": "myReplyTo",
    "messageId": "myMessageId",
    "timestamp": 999999999,
    "type": "myType",
    "appId": "myAppId"
  }
}

Plan sample:

Add in plan.json:

Exange:
{
  "id": "amqp_default",
  "exange": "MY_EXANGE",
  "exangeType": "direct",
  "routingKey": "runnerty.test.#",
  "message": "My message from Runnerty!",
  "options": {
    "persistent": true
  }
}
Or direct to Queue:
{
  "id": "amqp_default",
  "queue": "MY_QUEUE",
  "message": "My message from Runnerty!",
  "options": {
    "priority": 10
  }
}

Connection parameters

Option Type Description
protocol string The to be used protocol: "amqp" or "amqps". Default value: 'amqp'.
hostname string Hostname. Default value: 'localhost'
port string Port. Default value: 5672
username string Username. Default value: 'guest'
password string Password. Default value: 'guest'
locale string Password. Default value: 'en_US'
frameMax number The size in bytes of the maximum frame allowed. Default value: 0x1000
heartbeat number The period of the connection heartbeat in seconds. Default value: 0
vhost string What VHost shall be used. Default value: '/'

Message options

Can be set in config as default or in the process. The value indicated in the process overwrites the one indicated in config.
Option Type
expiration string/number
userId string
CC string/string[]
BCC string/string[]
mandatory boolean
persistent boolean
deliveryMode boolean/number
contentType string
contentEncoding string
headers object (key:value)
priority number
correlationId string
replyTo string
messageId string
timestamp number
type string
appId string

More information in amqp-lib api reference

Output (Process values):

  • PROCESS_EXEC_MSG_OUTPUT: Log operations message.
  • PROCESS_EXEC_ERR_OUTPUT: Error output message.