install rabbitMQ:
brew install rabbitmq
brew services start rabbitmq
web interface
http://localhost:15672/
name: guest
pwd: guest
install PG extension:
git clone https://github.com/omniti-labs/pg_amqp.git
make
make install
in every PG DB we want to use migrate:
CREATE EXTENSION amqp;
insert your login infromation (these are default):
INSERT INTO amqp.broker (host, port, username, password) VALUES ('127.0.0.1', '5672', 'guest', 'guest');
lookup broker id in amqp.broker table (the one you just inserted):
SELECT * FROM amqp.broker;
now you can send messages through amqp from PG like this:
SELECT amqp.publish(1, '', 'hello', 'Ahoj');
params of publish call as they appear:
1 -> broker id from previous step
'' -> leave blank for default AMQP exchange
'hello' -> name of the queue you are posting to
'Ahoj' -> payload (could be json and so according to PG specs)
To listen have a look at: