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

postgres-faktory-bridge

v0.0.1

Published

Send messages to Faktory from Postgresql

Downloads

1

Readme

Bridge Faktory and Postgres

Remember the old times when our grandfathers could not publish job payloads from Postgres to Faktory?

These dark days are over!

Installation

YARN

$ yarn global add postgres-faktory-bridge

NPM

$ npm install -g postgres-faktory-bridge

Usage

Start the bridge

# Environment variables
POSTGRESQL_URL=
FAKTORY_URL=
POSTGRESQL_DEFAULT_CHANNEL=
POSTGRESQL_CHANNEL_MAP=
JOB_DEFAULT_QUEUE=
JOB_DEFAULT_PRIORITY=
JOB_DEFAULT_RESERVE_FOR=
JOB_DEFAULT_RETRY=
JOB_DEFAULT_BACKTRACE=
JOB_DEFAULT_TYPE=
# Example
$ export POSTGRESQL_URL=postgres://user:pass@host:port/dbname
$ export FAKTORY_URL=127.0.0.1:7419
$ postgres-faktory-bridge

Notify a channel and publish a job

Example

SELECT pg_notify('faktoryJob', '{"queue": "MyQueue", "jobType": "MyJobType", "args": [1,2,3]}');

The job is created by using the LISTEN/NOTIFY notification system from Postgresql: NOTIFY channel [ , payload ]

The payload send by the Postgres notification is used as the job payload for Faktory.

  • @see https://github.com/contribsys/faktory/wiki/The-Job-Payload

The passed in options by the notification system will take presedence over the default environment variables - if present. The exception from this rule is: When there is a queue name mapped to channel - this queue will always be used.

JOB_DEFAULT_QUEUE=
JOB_DEFAULT_PRIORITY=
JOB_DEFAULT_RESERVE_FOR=
JOB_DEFAULT_RETRY=
JOB_DEFAULT_BACKTRACE=
JOB_DEFAULT_TYPE=

The default channel is called FaktoryJob and can be overwritten by the environment variable POSTGRESQL_DEFAULT_CHANNEL.

It is also possible to create a comma seperated list of channel and queue names in POSTGRESQL_CHANNEL_MAP.

The command syntax is: CHANNEL:[QUEUE]

$ export POSTGRESQL_CHANNEL_MAP=myChannel:anotherQueue,justAnotherChannel

When there is only a channel name - the current default queue in Faktory is used.

Things to consider

  • The bridge process can only be run on one machine/container etc. Otherwise every listening bridge will create a job in Faktory.