celluloid-io-pg-listener

LISTEN for Postgresql NOTIFY messages;

Asynchronously process payloads

Total Downloads Downloads Today Code Quality Network Stars Version Build Documentation Dependency Status

celluloid-io-pg-listener (on github)

Why?

At Trumaker & Co we had a distributed data problem. Two data stores that needed to be kept synchronized, in real time, with inserts and updates allowed on both sides. There wasn’t a good solution available for that, so I did a lot of research and built celluloid-io-pg-listener to solve the problem.

How?

The data stores are both PostgreSQL databases living in different namespaces (i.e. schemas in PostgreSQL-speak). A recently improved feature of PostgreSQL is the built-in pub/sub type messaging channel. It can pass payloads, and as of version 9.4, has a built-in function (json_build_object) to serialize data as JSON.

With some triggers and functions on both sides connected by the channel payloads would be sent with information about inserts and updates happening on the other side.

I want to know more!

Read this little tutorial.

comments powered by Disqus