package
0.0.0-20200821104852-f76c6d292a95
Repository: https://github.com/jvanderl/flogo-components.git
Documentation: pkg.go.dev

# README

AMQP Subscriber

This trigger provides your flogo application the ability to start a flow via AMQP

Installation

flogo install github.com/jvanderl/flogo-components/trigger/amqp

Link for flogo web:

https://github.com/jvanderl/flogo-components/trigger/amqp

Schema

Settings, Outputs and Endpoint:

{
  "settings":[
    {
      "name": "server",
      "type": "string",
      "required": true,
      "value" : "localhost"
    },
    {
      "name": "port",
      "type": "string",
      "required": true,
      "value" : "5672"
    },
    {
      "name": "userID",
      "type": "string",
      "required": true,
      "value" : "guest"
    },
    {
      "name": "password",
      "type": "string",
      "required": true,
      "value" : "guest"
    }
  ],
  "output": [
    {
      "name": "message",
      "type": "any"
    },
    {
      "name": "contentType",
      "type": "string"
    },
    {
      "name": "routingKey",
      "type": "string"
    }
  ],
  "handler": {
    "settings": [
      {
        "name": "exchange",
        "type": "string"
      },
      {
        "name": "exchangeType",
        "type": "string",
        "allowed" : ["direct", "fanout", "topic", "x-custom"],
        "value" : "direct"
      },
      {
        "name": "queueName",
        "type": "string"
      },
      {
        "name": "bindingKey",
        "type": "string"
      },
      {
        "name": "consumerTag",
        "type": "string"
      },
      {
        "name": "durable",
        "type": "boolean",
        "value": "true"
      },
      {
        "name": "autoDelete",
        "type": "boolean",
        "value": "false"
      },
      {
        "name": "exclusive",
        "type": "boolean",
        "value": "false"
      },
      {
        "name": "noWait",
        "type": "boolean",
        "value": "false"
      },
      {
        "name": "noAck",
        "type": "boolean",
        "value": "false"
      }
    ]
  }
}

Settings

SettingDescription
serverThe AMQP Host Name (default "localhost")
portThe AMQP Port Number (default "5672")
userIDThe UserID used when connecting to the AMQP server
passwordThe Password used when connecting to the AMQP server

Ouputs

OutputDescription
messageThe message payload
contentTypeThe content type of the message
routingKeyThe original routing key used by the AMQP publisher (handy when listening to wildcards)

Handlers

SettingDescription
exchangeThe exchange name used for the subscriber
exchangeTypeThe type of exchange. can be "direct", "fanout", "topic" or "x-custom"
queueNameThe queue name to listen to
bindingKeyThe binding key expresses interest. Use # for all, refer to AMQP documentation online
consumerTagFree to assign tag for the message consumer
durableCreates durable topic / queue when set to true (default "true")
autoDeleteDeletes topic / queue when no longer used (default "false")
exclusiveSets topic / queue up for internal use when set to true (default "false")
noWaitWhen set to true the server will not respond to the message (default "false")
noAckWhen set to true the server will not acknowledge the received message (default "false")

Example Configurations

Triggers are configured via the triggers.json of your application. The following are some example configuration of the AMQP Trigger.

Start a flow

Configure the Trigger to start "testFlow". So in this case the "endpoints" "settings" "destination" is "flogo" will start "testFlow" flow when a message arrives on a queue called "flogo" in this case.

{
  "name": "amqp",
  "settings": {
        "server": "localhost",
        "port": "5672",
        "userID": "guest",
        "password": "guest"
    },
  "handlers": [
    {
      "actionId": "local://testFlow",
      "settings": {
            "exchange": "test",
            "exchangeType": "direct",
            "queueName": "flogo",
            "bindingKey": "test",
            "consumerTag": "test",
            "durable": "true",
            "autoDelete": "false",
            "exclusive": "false",
            "noWait": "false",
            "noAck": "false"
      }
    }
  ]
}