Skip to content

Process notifies about notifications from postgresql

License

Notifications You must be signed in to change notification settings

mr-dxdy/pg_notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'

About

Process notifies about notifications from postgresql

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published