0.0
No commit activity in last 3 years
No release in over 3 years
Process notifies about postgresql notifications.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.14
~> 10.0
~> 3.0

Runtime

>= 0
 Project Readme

PgNotifier

Process notifies about postgresql notifications.

Installation

Add this line to your application's Gemfile:

gem 'pg_notifier'

Quickstart

Create notifiers.rb:

require 'pg_notifier'

module PgNotifier
  configure do |notifier|
    notifier.logger = Logger.new('/var/log/pg_notifier.log')
    notifier.db_config = {
      host: 'localhost',
      port: 5432,
      dbname: database_production,
      user: 'postgres',
      password: 'postgres'
    }
  end

  notify 'created_user' do |channel, pid, payload|
    puts "#{channel} #{pid} #{payload}"
  end
end

Run it with the pg_notifier executable:

$ pg_notifier notifiers.rb

If you need to load your entire environment for your jobs, simply add:

require 'pg_notifier'

require './config/boot'
require './config/environment'