Skip to content

Commit

Permalink
Making this an actual update and adding missing build targets
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Webster committed Aug 26, 2019
1 parent 96a25cd commit 0956699
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 7 deletions.
10 changes: 5 additions & 5 deletions META.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "pg_amqp",
"abstract": "AMQP protocol support for PostgreSQL",
"version": "0.4.2",
"version": "0.5.0",
"description": "The pg_amqp package provides the ability for postgres statements to directly publish messages to an AMQP broker.",
"maintainer":
[ "Theo Schlossnagle <[email protected]>", "Keith Fiske <[email protected]" ]
"maintainer":
[ "Theo Schlossnagle <[email protected]>", "Keith Fiske <[email protected]" ]
"license": [ "bsd", "mozilla_1_0" ],
"generated_by": "Keith Fiske",
"status": "stable",
Expand All @@ -19,7 +19,7 @@
"amqp": {
"file": "sql/amqp--0.4.1.sql",
"docfile": "doc/amqp.md",
"version": "0.4.1",
"version": "0.5.0",
"abstract": "AMQP protocol support for PostgreSQL"
}
},
Expand All @@ -32,7 +32,7 @@
"web": "https://github.com/omniti-labs/pg_amqp",
"type": "git"
}
},
},

"meta-spec": {
"version": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ MODULE_big = $(patsubst src/%.c,%,$(wildcard src/*.c))
OBJS = src/pg_amqp.o \
src/librabbitmq/amqp_api.o src/librabbitmq/amqp_connection.o src/librabbitmq/amqp_debug.o \
src/librabbitmq/amqp_framing.o src/librabbitmq/amqp_mem.o src/librabbitmq/amqp_socket.o \
src/librabbitmq/amqp_table.o
src/librabbitmq/amqp_table.o src/librabbitmq/amqp_tcp_socket.o src/librabbitmq/amqp_time.o


all: sql/$(EXTENSION)--$(EXTVERSION).sql
Expand Down
2 changes: 1 addition & 1 deletion amqp.control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# amqp extension
comment = 'AMQP protocol support for PostgreSQL'
default_version = '0.4.2'
default_version = '0.5.0'
module_pathname = '$libdir/pg_amqp'
relocatable = false
schema = amqp
85 changes: 85 additions & 0 deletions sql/amqp--0.5.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
CREATE TABLE @[email protected] (
broker_id serial NOT NULL,
host text NOT NULL,
port integer NOT NULL DEFAULT 5672,
vhost text,
username text,
password text,
PRIMARY KEY (broker_id, host, port)
);

SELECT pg_catalog.pg_extension_config_dump('@[email protected]', '');
SELECT pg_catalog.pg_extension_config_dump('@[email protected]_broker_id_seq', '');

CREATE FUNCTION @[email protected]_publish(
broker_id integer
, exchange varchar
, routing_key varchar
, message varchar
, delivery_mode integer default null
, content_type varchar default null
, reply_to varchar default null
, correlation_id varchar default null
)

RETURNS boolean AS 'pg_amqp.so', 'pg_amqp_autonomous_publish'
LANGUAGE C IMMUTABLE;

COMMENT ON FUNCTION @[email protected]_publish(integer, varchar, varchar, varchar, integer, varchar, varchar, varchar) IS
'Works as amqp.publish does, but the message is published immediately irrespective of the
current transaction state. PostgreSQL commit and rollback at a later point will have no
effect on this message being sent to AMQP.';


CREATE FUNCTION amqp.disconnect(broker_id integer)
RETURNS void AS 'pg_amqp.so', 'pg_amqp_disconnect'
LANGUAGE C IMMUTABLE STRICT;

COMMENT ON FUNCTION amqp.disconnect(integer) IS
'Explicitly disconnect the specified (broker_id) if it is current connected. Broker
connections, once established, live until the PostgreSQL backend terminated. This
allows for more precise control over that.
select amqp.disconnect(broker_id) from amqp.broker
will disconnect any brokers that may be connected.';


CREATE FUNCTION amqp.exchange_declare(
broker_id integer
, exchange varchar
, exchange_type varchar
, passive boolean
, durable boolean
, auto_delete boolean DEFAULT false
)
RETURNS boolean AS 'pg_amqp.so', 'pg_amqp_exchange_declare'
LANGUAGE C IMMUTABLE;

COMMENT ON FUNCTION amqp.exchange_declare(integer, varchar, varchar, boolean, boolean, boolean) IS
'Declares a exchange (broker_id, exchange_name, exchange_type, passive, durable, auto_delete)
auto_delete should be set to false (default) as unexpected errors can cause disconnect/reconnect which
would trigger the auto deletion of the exchange.';


CREATE FUNCTION @[email protected](
broker_id integer
, exchange varchar
, routing_key varchar
, message varchar
, delivery_mode integer default null
, content_type varchar default null
, reply_to varchar default null
, correlation_id varchar default null
)
RETURNS boolean AS 'pg_amqp.so', 'pg_amqp_publish'
LANGUAGE C IMMUTABLE;

COMMENT ON FUNCTION @[email protected](integer, varchar, varchar, varchar, integer, varchar, varchar, varchar) IS
'Publishes a message (broker_id, exchange, routing_key, message).
The message will only be published if the containing PostgreSQL transaction successfully commits.
Under certain circumstances, the AMQP commit might fail. In this case, a WARNING is emitted.
The last four parameters are optional and set the following message properties:
delivery_mode (either 1 or 2), content_type, reply_to and correlation_id.
Publish returns a boolean indicating if the publish command was successful. Note that as
AMQP publish is asynchronous, you may find out later it was unsuccessful.';

1 change: 1 addition & 0 deletions updates/amqp--0.4.1--0.5.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +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 comments on commit 0956699

Please sign in to comment.