Skip to content

Commit 0956699

Browse files
author
Patrick Webster
committed
Making this an actual update and adding missing build targets
1 parent 96a25cd commit 0956699

File tree

5 files changed

+93
-7
lines changed

5 files changed

+93
-7
lines changed

META.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "pg_amqp",
33
"abstract": "AMQP protocol support for PostgreSQL",
4-
"version": "0.4.2",
4+
"version": "0.5.0",
55
"description": "The pg_amqp package provides the ability for postgres statements to directly publish messages to an AMQP broker.",
6-
"maintainer":
7-
[ "Theo Schlossnagle <[email protected]>", "Keith Fiske <[email protected]" ]
6+
"maintainer":
7+
[ "Theo Schlossnagle <[email protected]>", "Keith Fiske <[email protected]" ]
88
"license": [ "bsd", "mozilla_1_0" ],
99
"generated_by": "Keith Fiske",
1010
"status": "stable",
@@ -19,7 +19,7 @@
1919
"amqp": {
2020
"file": "sql/amqp--0.4.1.sql",
2121
"docfile": "doc/amqp.md",
22-
"version": "0.4.1",
22+
"version": "0.5.0",
2323
"abstract": "AMQP protocol support for PostgreSQL"
2424
}
2525
},
@@ -32,7 +32,7 @@
3232
"web": "https://github.com/omniti-labs/pg_amqp",
3333
"type": "git"
3434
}
35-
},
35+
},
3636

3737
"meta-spec": {
3838
"version": "1.0.0",

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ MODULE_big = $(patsubst src/%.c,%,$(wildcard src/*.c))
1616
OBJS = src/pg_amqp.o \
1717
src/librabbitmq/amqp_api.o src/librabbitmq/amqp_connection.o src/librabbitmq/amqp_debug.o \
1818
src/librabbitmq/amqp_framing.o src/librabbitmq/amqp_mem.o src/librabbitmq/amqp_socket.o \
19-
src/librabbitmq/amqp_table.o
19+
src/librabbitmq/amqp_table.o src/librabbitmq/amqp_tcp_socket.o src/librabbitmq/amqp_time.o
2020

2121

2222
all: sql/$(EXTENSION)--$(EXTVERSION).sql

amqp.control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# amqp extension
22
comment = 'AMQP protocol support for PostgreSQL'
3-
default_version = '0.4.2'
3+
default_version = '0.5.0'
44
module_pathname = '$libdir/pg_amqp'
55
relocatable = false
66
schema = amqp

sql/amqp--0.5.0.sql

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
CREATE TABLE @[email protected] (
2+
broker_id serial NOT NULL,
3+
host text NOT NULL,
4+
port integer NOT NULL DEFAULT 5672,
5+
vhost text,
6+
username text,
7+
password text,
8+
PRIMARY KEY (broker_id, host, port)
9+
);
10+
11+
SELECT pg_catalog.pg_extension_config_dump('@[email protected]', '');
12+
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_broker_id_seq', '');
13+
14+
CREATE FUNCTION @[email protected]_publish(
15+
broker_id integer
16+
, exchange varchar
17+
, routing_key varchar
18+
, message varchar
19+
, delivery_mode integer default null
20+
, content_type varchar default null
21+
, reply_to varchar default null
22+
, correlation_id varchar default null
23+
)
24+
25+
RETURNS boolean AS 'pg_amqp.so', 'pg_amqp_autonomous_publish'
26+
LANGUAGE C IMMUTABLE;
27+
28+
COMMENT ON FUNCTION @[email protected]_publish(integer, varchar, varchar, varchar, integer, varchar, varchar, varchar) IS
29+
'Works as amqp.publish does, but the message is published immediately irrespective of the
30+
current transaction state. PostgreSQL commit and rollback at a later point will have no
31+
effect on this message being sent to AMQP.';
32+
33+
34+
CREATE FUNCTION amqp.disconnect(broker_id integer)
35+
RETURNS void AS 'pg_amqp.so', 'pg_amqp_disconnect'
36+
LANGUAGE C IMMUTABLE STRICT;
37+
38+
COMMENT ON FUNCTION amqp.disconnect(integer) IS
39+
'Explicitly disconnect the specified (broker_id) if it is current connected. Broker
40+
connections, once established, live until the PostgreSQL backend terminated. This
41+
allows for more precise control over that.
42+
select amqp.disconnect(broker_id) from amqp.broker
43+
will disconnect any brokers that may be connected.';
44+
45+
46+
CREATE FUNCTION amqp.exchange_declare(
47+
broker_id integer
48+
, exchange varchar
49+
, exchange_type varchar
50+
, passive boolean
51+
, durable boolean
52+
, auto_delete boolean DEFAULT false
53+
)
54+
RETURNS boolean AS 'pg_amqp.so', 'pg_amqp_exchange_declare'
55+
LANGUAGE C IMMUTABLE;
56+
57+
COMMENT ON FUNCTION amqp.exchange_declare(integer, varchar, varchar, boolean, boolean, boolean) IS
58+
'Declares a exchange (broker_id, exchange_name, exchange_type, passive, durable, auto_delete)
59+
auto_delete should be set to false (default) as unexpected errors can cause disconnect/reconnect which
60+
would trigger the auto deletion of the exchange.';
61+
62+
63+
CREATE FUNCTION @[email protected](
64+
broker_id integer
65+
, exchange varchar
66+
, routing_key varchar
67+
, message varchar
68+
, delivery_mode integer default null
69+
, content_type varchar default null
70+
, reply_to varchar default null
71+
, correlation_id varchar default null
72+
)
73+
RETURNS boolean AS 'pg_amqp.so', 'pg_amqp_publish'
74+
LANGUAGE C IMMUTABLE;
75+
76+
COMMENT ON FUNCTION @[email protected](integer, varchar, varchar, varchar, integer, varchar, varchar, varchar) IS
77+
'Publishes a message (broker_id, exchange, routing_key, message).
78+
The message will only be published if the containing PostgreSQL transaction successfully commits.
79+
Under certain circumstances, the AMQP commit might fail. In this case, a WARNING is emitted.
80+
The last four parameters are optional and set the following message properties:
81+
delivery_mode (either 1 or 2), content_type, reply_to and correlation_id.
82+
83+
Publish returns a boolean indicating if the publish command was successful. Note that as
84+
AMQP publish is asynchronous, you may find out later it was unsuccessful.';
85+

updates/amqp--0.4.1--0.5.0.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- NOTE: No changes to sql extension code contained in this update. Only C code has been patched, so a "make install" must be run to apply the library updates. You must also still run "ALTER EXTENSION amqp UPDATE' to update the extension version number in the database.

0 commit comments

Comments
 (0)