All Projects → meltwater → Gen_rmq

meltwater / Gen_rmq

Licence: mit
Elixir AMQP consumer and publisher behaviours

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Gen rmq

Amqpstorm
Thread-safe Python RabbitMQ Client & Management library
Stars: ✭ 130 (-10.96%)
Mutual labels:  rabbitmq, amqp
Rabbitmq Dump Queue
Dump messages from a RabbitMQ queue to files, without affecting the queue.
Stars: ✭ 139 (-4.79%)
Mutual labels:  rabbitmq, amqp
Laravel Queue Rabbitmq
RabbitMQ driver for Laravel Queue. Supports Laravel Horizon.
Stars: ✭ 1,175 (+704.79%)
Mutual labels:  rabbitmq, amqp
Rabbitmqbundle
RabbitMQ Bundle for the Symfony2 web framework
Stars: ✭ 1,125 (+670.55%)
Mutual labels:  rabbitmq, amqp
Rabbitmq Mock
Mock for RabbitMQ Java amqp-client
Stars: ✭ 114 (-21.92%)
Mutual labels:  rabbitmq, amqp
Rabbitmq Server
Open source RabbitMQ: core server and tier 1 (built-in) plugins
Stars: ✭ 9,064 (+6108.22%)
Mutual labels:  rabbitmq, amqp
Bunny
Bunny is a popular, easy to use, mature Ruby client for RabbitMQ
Stars: ✭ 1,224 (+738.36%)
Mutual labels:  rabbitmq, amqp
Yii2 Queue
Yii2 Queue Extension. Supports DB, Redis, RabbitMQ, Beanstalk and Gearman
Stars: ✭ 977 (+569.18%)
Mutual labels:  rabbitmq, amqp
Aiormq
Pure python AMQP 0.9.1 asynchronous client library
Stars: ✭ 112 (-23.29%)
Mutual labels:  rabbitmq, amqp
Amiquip
Pure Rust RabbitMQ client
Stars: ✭ 88 (-39.73%)
Mutual labels:  rabbitmq, amqp
Yii2 Rabbitmq
RabbitMQ Extension for Yii2
Stars: ✭ 52 (-64.38%)
Mutual labels:  rabbitmq, amqp
Bitnami Docker Rabbitmq
Bitnami Docker Image for RabbitMQ
Stars: ✭ 120 (-17.81%)
Mutual labels:  rabbitmq, amqp
Tackle
💯 percent reliable microservice communication
Stars: ✭ 44 (-69.86%)
Mutual labels:  rabbitmq, amqp
Humusamqp
PHP 7 AMQP library
Stars: ✭ 70 (-52.05%)
Mutual labels:  rabbitmq, amqp
Yii Queue
Queue extension for Yii 3.0
Stars: ✭ 38 (-73.97%)
Mutual labels:  rabbitmq, amqp
Rabbitroutine
Lightweight library that handles RabbitMQ auto-reconnect and publishing retry routine for you.
Stars: ✭ 77 (-47.26%)
Mutual labels:  rabbitmq, amqp
Spring Boot Rabbitmq
Spring Boot集成rabbitMQ实现消息推送
Stars: ✭ 24 (-83.56%)
Mutual labels:  rabbitmq, amqp
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-83.56%)
Mutual labels:  rabbitmq, amqp
Rabbus
A tiny wrapper over amqp exchanges and queues 🚌 ✨
Stars: ✭ 86 (-41.1%)
Mutual labels:  rabbitmq, amqp
Amqproxy
An intelligent AMQP proxy, with connection and channel pooling/reusing
Stars: ✭ 115 (-21.23%)
Mutual labels:  rabbitmq, amqp

Build Status Hex Version Coverage Status Hex.pm Download Total Dependabot Status

GenRMQ

GenRMQ is a set of behaviours meant to be used to create RabbitMQ consumers and publishers.

Internally it is using the AMQP elixir RabbitMQ client. The idea is to reduce boilerplate consumer / publisher code, which usually includes:

  • creating connection / channel and keeping it in a state
  • creating and binding queue
  • handling reconnections / consumer cancellations

GenRMQ provides the following functionality:

  • GenRMQ.Consumer - a behaviour for implementing RabbitMQ consumers (example)
  • GenRMQ.Publisher - a behaviour for implementing RabbitMQ publishers (example)
  • GenRMQ.Processor - a behaviour for implementing RabbitMQ message processors (this is useful to separate out business logic from your consumer) (example)
  • GenRMQ.Consumer.Telemetry - telemetry events emitted by a GenRMQ consumer
  • GenRMQ.Publisher.Telemetry - telemetry events emitted by a GenRMQ publisher
  • GenRMQ.RabbitCase - test utilities for RabbitMQ (example)

Installation

def deps do
  [{:gen_rmq, "~> 3.0.0"}]
end

Migrations

Version 3.0.0 has been released. Please check how to migrate to gen_rmq 3.0.0.

Examples

More thorough examples for using GenRMQ.Consumer, GenRMQ.Publisher, and GenRMQ.Processor can be found under documentation.

Consumer

defmodule Consumer do
  @behaviour GenRMQ.Consumer

  @impl GenRMQ.Consumer
  def init() do
    [
      queue: "gen_rmq_in_queue",
      exchange: "gen_rmq_exchange",
      routing_key: "#",
      prefetch_count: "10",
      connection: "amqp://guest:[email protected]:5672",
      retry_delay_function: fn attempt -> :timer.sleep(2000 * attempt) end
    ]
  end

  @impl GenRMQ.Consumer
  def consumer_tag() do
    "test_tag"
  end

  @impl GenRMQ.Consumer
  def handle_message(message) do
    ...
  end

  @impl GenRMQ.Consumer
  def handle_error(message, _reason) do
    GenRMQ.Consumer.reject(message, true)
  end
end
GenRMQ.Consumer.start_link(Consumer, name: Consumer)

This will result in:

  • durable gen_rmq_exchange.deadletter exchange created or redeclared
  • durable gen_rmq_in_queue_error queue created or redeclared. It will be bound to gen_rmq_exchange.deadletter
  • durable topic gen_rmq_exchange exchange created or redeclared
  • durable gen_rmq_in_queue queue created or redeclared. It will be bound to gen_rmq_exchange exchange and has a deadletter exchange set to gen_rmq_exchange.deadletter
  • every handle_message callback will be executed in a separate supervised Task. This can be disabled by setting concurrency: false in init callback
  • on failed rabbitmq connection it will wait for a bit and then reconnect

There are many options to control the consumer setup details, please check the c:GenRMQ.Consumer.init/0 docs for all available settings.

Publisher

defmodule Publisher do
  @behaviour GenRMQ.Publisher

  def init() do
    [
      exchange: "gen_rmq_exchange",
      connection: "amqp://guest:[email protected]:5672"
    ]
  end
end
GenRMQ.Publisher.start_link(Publisher, name: Publisher)
GenRMQ.Publisher.publish(Publisher, Jason.encode!(%{msg: "msg"}))

Documentation

Examples

Guides

Metrics

Migrations

Running Tests

You need docker-compose installed.

$ make test

How to Contribute

Please see our Contribution Guidelines.

Are you using GenRMQ in Production? Please let us know, we are curious to learn about your experiences!

Maintainers

The maintainers are responsible for the general project oversight, and empowering further trusted committers (see below).

The maintainers are the ones that create new releases of GenRMQ.

Trusted Committers

Trusted Committers are members of our community who we have explicitly added to our GitHub repository. Trusted Committers have elevated rights, allowing them to send in changes directly to branches and to approve Pull Requests. For details see TRUSTED-COMMITTERS.md.

Note: Maintainers and Trusted Committers are listed in .github/CODEOWNERS in order to automatically assign PR reviews to them.

License

The MIT License.

Copyright (c) Meltwater Inc. underthehood.meltwater.com

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