All Projects → ssimicro → lib_mysqludf_amqp

ssimicro / lib_mysqludf_amqp

Licence: MIT license
Publish messages via AMQP directly from MySQL

Programming Languages

c
50402 projects - #5 most used programming language
M4
1887 projects
Makefile
30231 projects
shell
77523 projects

Projects that are alternatives of or similar to lib mysqludf amqp

Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+4018.75%)
Mutual labels:  amqp
Akka Rabbitmq
RabbitMq client in Scala and Akka actors
Stars: ✭ 228 (+375%)
Mutual labels:  amqp
lib mysqludf redis
Provides Mysql UDF commands to synchronize data from Mysql to Redis.
Stars: ✭ 20 (-58.33%)
Mutual labels:  udf
Qpid Proton
Mirror of Apache Qpid Proton
Stars: ✭ 164 (+241.67%)
Mutual labels:  amqp
Enmasse
EnMasse - Self-service messaging on Kubernetes and OpenShift
Stars: ✭ 185 (+285.42%)
Mutual labels:  amqp
Azure Event Hubs
☁️ Cloud-scale telemetry ingestion from any stream of data with Azure Event Hubs
Stars: ✭ 233 (+385.42%)
Mutual labels:  amqp
Garagemq
AMQP message broker implemented with golang
Stars: ✭ 153 (+218.75%)
Mutual labels:  amqp
fs2-rabbit
🐰 RabbitMQ stream-based client built on top of Fs2
Stars: ✭ 143 (+197.92%)
Mutual labels:  amqp
Gosiris
An actor framework for Go
Stars: ✭ 222 (+362.5%)
Mutual labels:  amqp
Py Amqp
amqplib fork
Stars: ✭ 252 (+425%)
Mutual labels:  amqp
Rabtap
RabbitMQ wire tap and swiss army knife
Stars: ✭ 171 (+256.25%)
Mutual labels:  amqp
Librabbitmq
Python bindings to librabbitmq-c
Stars: ✭ 181 (+277.08%)
Mutual labels:  amqp
Azure Service Bus Dotnet
☁️ .NET Standard client library for Azure Service Bus
Stars: ✭ 237 (+393.75%)
Mutual labels:  amqp
Cony
Simple AMQP wrapper around github.com/streadway/amqp
Stars: ✭ 158 (+229.17%)
Mutual labels:  amqp
dispatcher
Dispatcher is an asynchronous task queue/job queue based on distributed message passing.
Stars: ✭ 60 (+25%)
Mutual labels:  amqp
Laravel Queue
Laravel Enqueue message queue extension. Supports AMQP, Amazon SQS, Kafka, Google PubSub, Redis, STOMP, Gearman, Beanstalk and others
Stars: ✭ 155 (+222.92%)
Mutual labels:  amqp
Enqueue Bundle
[READ-ONLY] Message queue bundle for Symfony. RabbitMQ, Amazon SQS, Redis, Service bus, Async events, RPC over MQ and a lot more
Stars: ✭ 233 (+385.42%)
Mutual labels:  amqp
amqpprox
An AMQP 0.9.1 proxy server, designed for use in front of an AMQP 0.9.1 compliant message queue broker such as RabbitMQ.
Stars: ✭ 51 (+6.25%)
Mutual labels:  amqp
the-white-rabbit
The White Rabbit is an asynchronous RabbitMQ (AMQP) client based on Kotlin coroutines
Stars: ✭ 90 (+87.5%)
Mutual labels:  amqp
Aioamqp
AMQP implementation using asyncio
Stars: ✭ 244 (+408.33%)
Mutual labels:  amqp

lib_mysqludf_amqp

lib_mysqludf_amqp is a MySQL user-defined function library for sending AMQP messages.

Requirements

Building

These are the instructions for building releases. If you are building from non-release source (e.g. git clone) and there is no ./configure script, run ./autogen first and then follow the instructions below..

$ ./configure
$ make
# sudo make install
# service mysql-server restart
$ make installdb

Example

Hello, World!

Publishes a string 'Hello, World!' to the udf exchange on localhost:5672 with a routing key of test as the user guest with the password guest. Upon success, the message ID is returned.

mysql> SELECT lib_mysqludf_amqp_sendstring('amqp://guest:guest@localhost:5672', 'udf', 'test', 'Hello, World!');
+---------------------------------------------------------------------------------------------------+
| lib_mysqludf_amqp_sendstring('amqp://guest:guest@localhost:5672', 'udf', 'test', 'Hello, World!') |
+---------------------------------------------------------------------------------------------------+
| 000e9ced-9050-4454-8eb4-afe78c336b13                                                              |
+---------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Table Watcher

The following publishes JSON objects representing table rows whenever a row is inserted, updated, or deleted.

SET @AMQP_URL = 'amqp://guest:guest@localhost:5672';
SET @AMQP_EXCHANGE = 'udf';

DROP TABLE IF EXISTS `accounts`;
CREATE TABLE `accounts` (
    `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
    `username` varchar(64) NOT NULL,
     PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='Customer Accounts';

DELIMITER ;;

DROP TRIGGER IF EXISTS `after_insert_on_accounts`;
CREATE DEFINER=`root`@`localhost` TRIGGER `after_insert_on_accounts` AFTER INSERT ON `accounts` FOR EACH ROW BEGIN
    SET @message_id = (SELECT lib_mysqludf_amqp_sendjson(@AMQP_URL, @AMQP_EXCHANGE, 'accounts.insert', json_object('id', NEW.id, 'username', NEW.username)));
END ;;

DROP TRIGGER IF EXISTS `after_update_on_accounts`;
CREATE DEFINER=`root`@`localhost` TRIGGER `after_update_on_accounts` AFTER UPDATE ON `accounts` FOR EACH ROW BEGIN
    SET @message_id = (SELECT lib_mysqludf_amqp_sendjson(@AMQP_URL, @AMQP_EXCHANGE, 'accounts.update', json_object('id', NEW.id, 'username', NEW.username)));
END ;;

DROP TRIGGER IF EXISTS `after_delete_on_accounts`;
CREATE DEFINER=`root`@`localhost` TRIGGER `after_delete_on_accounts` AFTER DELETE ON `accounts` FOR EACH ROW BEGIN
    SET @message_id = (SELECT lib_mysqludf_amqp_sendjson(@AMQP_URL, @AMQP_EXCHANGE, 'accounts.delete', json_object('id', OLD.id, 'username', OLD.username)));
END ;;

DELIMITER ;

INSERT INTO accounts (username) values ('jdoe');
UPDATE accounts SET username = 'jsmith';
DELETE FROM accounts WHERE id = last_insert_id();

API

lib_mysqludf_amqp_info()

Returns an informational message denoting the package name and version.

Parameters

None. Supplying any parameters will result in an error.

Returns

A string representation of the package name and version, separated by a single space. For example, lib_mysqludf_amqp 2.0.0.

Errors

  • invalid arguments Raised when the function is called with arguments.

Example

SELECT lib_mysqludf_amqp_info();

lib_mysqludf_amqp_sendstring(url, exchange, routingKey, message)

Sends a plain text message to the given exchange on the provided hostname and port with the supplied routingKey as username identified by password.

Parameters

  • url (string). amqp://[$USERNAME[:$PASSWORD]@]$HOST[:$PORT]/[$VHOST]
  • exchange (string). The name of the AMQP exchange to publish the message to.
  • routingKey (string). The routing key for this message.
  • message (string). The body of the message.

Returns

Upon succes, this function returns a string containing the message ID, a Universally Unique IDentifier (UUID) (v4).

Upon failure, either NULL is returned or an error is raised.

Errors

  • invalid arguments Raised when the function is called with an invalid number of arguments or when any argument is not of the correct type.
  • socket error Raised when a socket cannot be allocated.
  • socket open error Raised when a socket cannot be opened.
  • login error Raised when authentication against the AMQP server specified by hostname and port fails using the supplied credentials, username and password.
  • channel error Raised when a communications channel cannot be opened between this module and the AMQP server.
  • malloc error Raised when the memory allocation routine malloc() fails.

Example

Login as user guest with password guest to the AMQP server running on localhost port 5672 and publish the message Hello, World! with routing key test to exchange udf:

SELECT lib_mysqludf_amqp_sendstring('amqp://guest:guest@localhost:5672', 'udf', 'test', 'Hello, World!');

lib_mysqludf_amqp_sendjson(url, exchange, routingKey, message)

Sends a JSON message to the given exchange on the provided hostname and port with the supplied routingKey as username identified by password.

Parameters

  • url (string). amqp://[$USERNAME[:$PASSWORD]@]$HOST[:$PORT]/[$VHOST]
  • exchange (string). The name of the AMQP exchange to publish the message to.
  • routingKey (string). The routing key for this message.
  • message (string). The body of the message, a JSON string.

Returns

Upon succes, this function returns a string containing the message ID, a Universally Unique IDentifier (UUID) (v4).

Upon failure, either NULL is returned or an error is raised.

Errors

  • invalid arguments Raised when the function is called with an invalid number of arguments or when any argument is not of the correct type.
  • socket error Raised when a socket cannot be allocated.
  • socket open error Raised when a socket cannot be opened.
  • login error Raised when authentication against the AMQP server specified by hostname and port fails using the supplied credentials, username and password.
  • channel error Raised when a communications channel cannot be opened between this module and the AMQP server.
  • malloc error Raised when the memory allocation routine malloc() fails.

Example

Login as user guest with password guest to the AMQP server running on localhost port 5672 and publish the message { "info": "lib_mysqludf_amqp 0.0.0" } with routing key test to exchange udf:

SELECT lib_mysqludf_amqp_sendjson('amqp://guest:guest@localhost:5672', 'udf', 'test', json_object('lib_mysqludf_amqp_info', cast(lib_mysqludf_amqp_info() as char)));

License

See COPYING.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].