npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

openwhisk-amqp-trigger-feed

v1.0.0

Published

AMQP Trigger Feed Event Source for Apache OpenWhisk using the Pluggable Event Provider

Downloads

3

Readme

Apache OpenWhisk AMQP Event Provider

This is an Apache OpenWhisk trigger feed for an AMQP provider (e.g. RabbitMQ). Messages arriving on a queue are fired as trigger events. Messages are processed one at a time, i.e. the next trigger won't be fired until the last message have been processed.

usage

| Entity | Type | Parameters | | ------------------------------------------ | ---- | ------------------------------------- | | /<PROVIDER_NS>/amqp-trigger-feed/changes | feed | url, queue, format, cert, cert_format |

  • url is the full AMQP URL for the broker, e.g. amqp(s)://user:[email protected]:port
    • mandatory parameter
  • queue is the queue to listen for messages on. This queue must already exist in the broker.
    • mandatory parameter
  • format is the format incoming queue messages should be converted before firing as trigger events.
    • valid values: json, utf-8 & base64
    • default value: utf-8
  • cert is the PEM server certificate string.
  • cert_format is the PEM server certificate format
    • valid values: utf-8 & base64.
    • default value: utf-8

cli example

wsk trigger create test-amqp-trigger --feed /<PROVIDER_NS>/amqp-trigger-feed/changes --param url <AMQP_URL> --param queue <QUEUE_NAME>

trigger events

Trigger events fired by the provider have a single property (message) which contains the queue message.

{"message":"<QUEUE_MESSAGE>"}

message format

AMQP messages are received as native Node.js buffers. Before firing as trigger events this must be converted to a format suitable for encoding in a JSON message. By default the message contents will be converted to a UTF-8 string. The conversion format can be controlled by setting the format trigger parameter.

Using base64 as the format will encoded the raw Buffer as a Base64 string before firing the trigger event. If json is used as the format, the buffer is converted to a string and parsed as a JSON object.

connecting over ssl

If you need to connect to a AMQP broker over TLS, use the amqp:// URL prefix in the URL parameter.

If the broker uses a self-signed certificate, this will need to be provided in the trigger parameter options. The cert parameter is used to provide the certificate value, which can either be the raw certificate string (-----BEGIN CERTIFICATE-----…) or a base64-encoded version. If you provide a base-64 encoded version, make sure you specify the cert_format parameter to be base64.

errors

If there are any issues with the connection to the broker, the trigger will be automatically disabled. Error details on what has gone wrong are available by retrieving the latest status of the trigger.

wsk trigger get test-amqp-trigger

development

running

See the "Pluggable OpenWhisk Event Provider" docs on how to run this event provider. The following environment parameters are needed for this feed provider.

unit tests

npm test

integration tests

  • Create a test/integration/config.json with the following values.
{
  "openwhisk": {
    "apihost": "<OW_HOSTNAME>",
    "api_key": "<OW_KEY>",
    "namespace": "_",
    "trigger": "amqp-trigger-feed-test",
    "rule": "amqp-rule-feed-test"
  },
  "amqp": {
    "url": "<AMQP_BROKER_URL>",
    "queue": "amqp-feed-provider-test"
  }
}
  • Run the integration tests
npm run test-integration