All Projects → atheriel → longears

atheriel / longears

Licence: other
The RabbitMQ client for R

Programming Languages

c
50402 projects - #5 most used programming language
r
7636 projects
C++
36643 projects - #6 most used programming language
M4
1887 projects

Projects that are alternatives of or similar to longears

nabbitmq
Node.js library for interacting with RabbitMQ based on RxJS streams
Stars: ✭ 20 (-37.5%)
Mutual labels:  rabbitmq, rabbitmq-client
node-carotte-amqp
An amqplib wrapper for microservices
Stars: ✭ 27 (-15.62%)
Mutual labels:  rabbitmq, rabbitmq-client
rabbitmq-stream-dotnet-client
RabbitMQ client for the stream protocol
Stars: ✭ 58 (+81.25%)
Mutual labels:  rabbitmq, rabbitmq-client
eshopzero
.Net Microservice Application
Stars: ✭ 27 (-15.62%)
Mutual labels:  rabbitmq, rabbitmq-client
net-amqp-rabbitmq
Perl bindings to the librabbitmq-c AMQP library.
Stars: ✭ 23 (-28.12%)
Mutual labels:  rabbitmq, rabbitmq-client
Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+6078.13%)
Mutual labels:  rabbitmq, rabbitmq-client
sample-message-driven-microservices
sample spring cloud application that integrates with rabbitmq through spring cloud stream framework as shows how to setup message-driven microservices basing on publish-subscribe model, consumer groups
Stars: ✭ 28 (-12.5%)
Mutual labels:  rabbitmq
fluent-plugin-rabbitmq
Fluent input/output plugin for RabbitMQ.
Stars: ✭ 26 (-18.75%)
Mutual labels:  rabbitmq
sample-spring-cloud-stream
sample microservices communicating asynchronously using spring cloud stream, rabbitmq
Stars: ✭ 22 (-31.25%)
Mutual labels:  rabbitmq
grabbit
A lightweight transactional message bus on top of RabbitMQ
Stars: ✭ 87 (+171.88%)
Mutual labels:  rabbitmq
distmq
Distributed Message Queue based on Raft
Stars: ✭ 32 (+0%)
Mutual labels:  rabbitmq
roger-rabbit
A module that makes the process of consuming and publishing messages in message brokers easier
Stars: ✭ 12 (-62.5%)
Mutual labels:  rabbitmq
gome
gome- Golang Match Engine, uses Golang for calculations, gRPC for services, ProtoBuf for data exchange, RabbitMQ for queues, and Redis for cache implementation of high-performance matching engine microservices/ gome-高性能撮合引擎微服务
Stars: ✭ 47 (+46.88%)
Mutual labels:  rabbitmq
Rabbit-OJ-Backend
Using Go & MySQL & Docker & Web Socket & gRPC & Kafka & Zookeeper & Protobuf. Distributed and Scalable Open Judge System for Algorithms.
Stars: ✭ 20 (-37.5%)
Mutual labels:  rabbitmq
Spring-Boot-2
Spring Boot 2.x examples
Stars: ✭ 33 (+3.13%)
Mutual labels:  rabbitmq
your-connection-deserves-a-name
Examples and code to assign a name to your MongoDB, MySQL, NATS, Oracle, PostgreSQL, RabbitMQ, and redis connection.
Stars: ✭ 26 (-18.75%)
Mutual labels:  rabbitmq
broadway bike sharing rabbitmq example
An example of a Broadway pipeline for a bike sharing app with RabbitMQ and PostgreSQL
Stars: ✭ 27 (-15.62%)
Mutual labels:  rabbitmq
AMQPClient.jl
A Julia AMQP (Advanced Message Queuing Protocol) / RabbitMQ Client.
Stars: ✭ 30 (-6.25%)
Mutual labels:  rabbitmq
event-driven-example
An example Event-Driven application in Go built with Watermill library.
Stars: ✭ 81 (+153.13%)
Mutual labels:  rabbitmq
tibbar
🐇 Minimalist microservice framework for node and RabbitMQ.
Stars: ✭ 12 (-62.5%)
Mutual labels:  rabbitmq

longears

CRAN status R-CMD-check

longears is a fast and fully-featured RabbitMQ client for R, built on top of the reference C library, librabbitmq.

RabbitMQ itself is a highly popular, performant, and robust open-source message broker used to build distributed systems.

longears implements a large portion of the Advanced Message Queuing Protocol (AMQP) used by RabbitMQ , and the API largely reflects the protocol itself. However, this package is not a true low-level interface: it abstracts away many details of AMQP for end users. See Limitations for details.

This package may be of interest to you if you wish to have R speak to your organization’s existing RabbitMQ servers; if you simply need a message queue library, you may be better off with txtq, litq, or the ZeroMQ package rzmq.

Installation

To install longears as a source package you will need its system dependency, librabbitmq. Normally if this library is missing during installation, the configure script will attempt to download and build it directly (provided you have cmake installed).

You may still wish to use your platform’s provided librabbitmq instead, especially if this process fails. On Debian-based systems (including Ubuntu) you can get this library by running the following from the command line:

$ apt install librabbitmq-dev

For other platforms:

  • macOS (via Homebrew): brew install rabbitmq-c
  • Fedora-based: yum install librabbitmq-devel
  • Arch-based: pacman -S librabbitmq-c
  • Windows (via Rtools): pacman -Sy mingw-w64-{i686,x86_64}-rabbitmq-c

longears is not yet available on CRAN. You can install it from GitHub with

# install.packages("remotes")
remotes::install_github("atheriel/longears")

Basic Usage

If you are not already familiar with RabbitMQ and the message/queue/binding/exchange terminology, I suggest their excellent conceptual overview.

You will also need to have a local RabbitMQ server running with the default settings to follow this guide.

$ # apt install rabbitmq-server
$ systemctl start rabbitmq-server
$ rabbitmqctl status

First, connect to the server (with the default settings):

conn <- amqp_connect()
conn
#> AMQP Connection:
#>   status:  connected
#>   address: localhost:5672
#>   vhost:   '/'

Create an exchange to route messages and a couple of queues to store them:

amqp_declare_exchange(conn, "my.exchange", type = "fanout")
amqp_declare_queue(conn, "my.queue1")
#> AMQP queue 'my.queue1'
#>   messages:  0
#>   consumers: 0
amqp_declare_queue(conn, "my.queue2")
#> AMQP queue 'my.queue2'
#>   messages:  0
#>   consumers: 0
amqp_bind_queue(conn, "my.queue1", "my.exchange", routing_key = "#")
amqp_bind_queue(conn, "my.queue2", "my.exchange", routing_key = "#")

You can also set up a consumer for one of these queues with a callback:

received <- 0
consumer <- amqp_consume(conn, "my.queue2", function(msg) {
  received <<- received + 1
})

Now, send a few messages to this exchange:

amqp_publish(conn, "first", exchange = "my.exchange", routing_key = "#")
amqp_publish(conn, "second", exchange = "my.exchange", routing_key = "#")

Check if your messages are going into the queues:

$ rabbitmqctl list_queues

You can use amqp_get() to pull individual messages back into R:

amqp_get(conn, "my.queue1")
#> Delivery Tag:    1
#> Redelivered: FALSE
#> Exchange:    my.exchange
#> Routing Key: #
#> Message Count:   1
#> 66 69 72 73 74
amqp_get(conn, "my.queue1")
#> Delivery Tag:    2
#> Redelivered: FALSE
#> Exchange:    my.exchange
#> Routing Key: #
#> Message Count:   0
#> 73 65 63 6f 6e 64
amqp_get(conn, "my.queue1")
#> character(0)

Or you can use amqp_listen() to run consumer callbacks:

amqp_listen(conn, timeout = 1)
received
#> [1] 2

To clean things up, delete the queues, the exchange, and disconnect from the server.

amqp_delete_queue(conn, "my.queue1")
amqp_delete_queue(conn, "my.queue2")
amqp_delete_exchange(conn, "my.exchange")
amqp_disconnect(conn)
conn
#> AMQP Connection:
#>   status:  disconnected
#>   address: localhost:5672
#>   vhost:   '/'

And check that the connection is closed:

$ rabbitmqctl list_connections

Limitations

Some AMQP features are not present, notably transaction support (which there are no plans to implement). Others are handled internally according to best practices, even when they are not exposed through the API – channels, message acknowledgements, and prefetch counts are in this category. A design goal of the package is to shield users from some details, especially if departures from best practice are rare.

If you have need of an AMQP feature (or RabbitMQ extension) that is not currently available or accessible, please consider filing an issue explaining the use case you have in mind.

License

The package is licensed under the GPL, version 2 or later.

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].