Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Developing RabbitMQ plugins in Elixir
Matt...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
$ whoami
Software Engineer @ F-Secure Corp...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Topic
RabbitMQ plugins
Hello World plugin
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
RabbitMQ plugins
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Installing RabbitMQ plugins
RabbitMQ plugi...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Topic
RabbitMQ plugins
Hello World plugin
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
RabbitMQ plugin
Erlang Application consist...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Requirements
▶ Erlang
▶ Elixir
▶ Git
▶ Mak...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Makefile
PROJECT = my_first_rabbitmq_plugi...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Building the plugin
make
Fetches the depen...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Elixir mix.exs
def project do
[
app: :my_f...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Makefile with Mix rule
PROJECT = my_first_...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Hello World
defmodule RabbitMQ.HelloWorldP...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Where to go next
Read the source!
Most of ...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Topic
RabbitMQ plugins
Hello World plugin
...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
RabbitMQ message deduplication plugin
Plug...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Conclusions
Getting started is easy
Rabbit...
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
References
RabbitMQ Plugins and developmen...
Upcoming SlideShare
Loading in …5
×

Developing RabbitMQ plugins in Elixir - Matteo Cafasso

137 views

Published on

Watch the full lecture on YouTube: https://www.youtube.com/watch?v=8pNh_F-hQ54&list=PLDUzG2yLXrU4Lz33ZzSdHyfqdHJ8Zum5A

RabbitMQ comprises of a state of the art plugin architecture, allowing it to be highly customizable and extensible to meet various requirements which may not be supported by an "out-of-the-box" broker installation. This presentation gives an overview of RabbitMQ's plugin infrastructure and discusses some useful, existing plugins with an overview of developing custom RabbitMQ plugins in Elixir. With Elixir being a language fully compatible with the Erlang Virtual Machine and growing in popularity, the RabbitMQ core team also adopted it in developing the next generation CLI-tools found in the latest release series, 3.7.x; a strong indication on the direction and future of RabbitMQ's product development. Outcome of this presentation looks to encourage more RabbitMQ plugin development in Elixir from the community!
--

The first RabbitMQ Summit connected RabbitMQ users and developers from around the world in London on November 12, 2018. Learn what's happening in and around RabbitMQ, and how top companies utilize RabbitMQ to power their services.

https://www.rabbitmqsummit.com

RabbitMQ Summit was organized by:
- Erlang Solutions, offering world-leading RabbitMQ Consultancy, Support, Health Checks & Tuning solutions https://www.erlang-solutions.com/
- CloudAMQP, offering fully managed RabbitMQ clusters https://www.cloudamqp.com

RabbitMQ Summit 2018 was sponsored by the following companies.

Platinum sponsors:
Pivotal
LShift

Gold sponors:
Trifork
AWS

Silver sponsor:
Cogin Queue Explorer

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Developing RabbitMQ plugins in Elixir - Matteo Cafasso

  1. 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Developing RabbitMQ plugins in Elixir Matteo Cafasso Lead Software Engineer @ F-Secure GitHub noxdafox Twitter @nox_da_fox 2018-11-12
  2. 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . $ whoami Software Engineer @ F-Secure Corporation Backend development Distributed systems enthusiast. Malware analysis automation Behavioural/dynamic malware analysis.
  3. 3. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Topic RabbitMQ plugins Hello World plugin Case study and Conclusions
  4. 4. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RabbitMQ plugins
  5. 5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Installing RabbitMQ plugins RabbitMQ plugins are shipped as Erlang '.ez' archive files. To install a plugin is enough to copy its archive file in the RabbitMQ plugins directory. The rabbitmq-plugins tool can be used to load a plugin. rabbitmq-plugins list # list the available plugins rabbitmq-plugins enable <plugin-name> # enable a plugin rabbitmq-plugins disable <plugin-name> # disable a plugin
  6. 6. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Topic RabbitMQ plugins Hello World plugin Case study and Conclusions
  7. 7. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RabbitMQ plugin Erlang Application consisting in one or more supervised processes interfacing with the broker via: ▶ message passing ▶ modules implementing specific behaviours
  8. 8. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Requirements ▶ Erlang ▶ Elixir ▶ Git ▶ Make ▶ Zip
  9. 9. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Makefile PROJECT = my_first_rabbitmq_plugin DEPS = rabbit_common rabbit DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk # FIXME: Use erlang.mk patched for RabbitMQ, while waiting for PRs to be # reviewed and merged. ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git ERLANG_MK_COMMIT = rabbitmq-tmp # https://github.com/rabbitmq/rabbitmq-common include rabbitmq-components.mk # https://github.com/ninenines/erlang.mk include erlang.mk
  10. 10. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Building the plugin make Fetches the dependencies and builds the source. make run-broker Builds and starts the server altogether with the plugin under development. make tests Runs the tests. make dist Builds the plugin and packages it in a '.ez' archive.
  11. 11. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Elixir mix.exs def project do [ app: :my_first_rabbitmq_plugin, version: "0.0.1", deps: deps() ] end # Do not compile RabbitMQ dependencies defp deps() do [ { :rabbit, path: "deps/rabbit", # specify local dependencies folder location compile: ":", # give a "noop" as compiling command override: true }, ... ] end
  12. 12. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Makefile with Mix rule PROJECT = my_first_rabbitmq_plugin DEPS = rabbit_common rabbit DEP_PLUGINS = rabbit_common/mk/rabbitmq-plugin.mk # Add make app rule for Elixir plugin elixir_srcs := mix.exs app:: $(elixir_srcs) deps $(MIX) deps.get $(MIX) deps.compile $(MIX) compile ERLANG_MK_REPO = https://github.com/rabbitmq/erlang.mk.git ERLANG_MK_COMMIT = rabbitmq-tmp include rabbitmq-components.mk include erlang.mk
  13. 13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hello World defmodule RabbitMQ.HelloWorldPlugin do Module.register_attribute __MODULE__, :rabbit_boot_step, accumulate: true, persist: true @rabbit_boot_step {__MODULE__, [description: "hello world rabbitmq plugin", mfa: {__MODULE__, :hello_world, []}, requires: :notify_cluster]} def hello_world() do IO.puts("Hello World!") end end
  14. 14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Where to go next Read the source! Most of the interfaces and data structures can be found in the 'rabbitmq-commons' repository. Behaviours ▶ rabbit_exchange_type ▶ rabbit_backing_queue ▶ rabbit_authz_backend
  15. 15. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Topic RabbitMQ plugins Hello World plugin Case study and Conclusions
  16. 16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RabbitMQ message deduplication plugin Plugin for filtering duplicate messages. Duplicates are identified based on the 'x-deduplication-header' header content. Deduplication can be applied on exchanges and on queues.
  17. 17. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Conclusions Getting started is easy RabbitMQ plugins tend to be simple Two supported languages: Erlang and Elixir Excellent learning experience
  18. 18. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . References RabbitMQ Plugins and development guides https://www.rabbitmq.com/plugins.html https://www.rabbitmq.com/plugin-development.html RabbitMQ Plugins in Elixir https://binarin.ru/post/rabbitmq-plugins-in-elixir/ Slides and examples https://github.com/noxdafox/rabbitmqsummit2018

×