Giter Site home page Giter Site logo

rabbitmq-event-exchange's Introduction

RabbitMQ Event Exchange

This repository has been moved to the main unified RabbitMQ "monorepo", including all open issues. You can find the source under /deps/rabbitmq_event_exchange. All issues have been transferred.

Overview

This plugin exposes the internal RabbitMQ event mechanism as messages that clients can consume. It's useful if you want to keep track of certain events, e.g. when queues, exchanges, bindings, users, connections, channels are created and deleted. This plugin filters out stats events, so you are almost certainly going to get better results using the management plugin for stats.

How it Works

It declares a topic exchange called 'amq.rabbitmq.event' in the default virtual host. All events are published to this exchange with routing keys like 'exchange.created', 'binding.deleted' etc, so you can subscribe to only the events you're interested in.

The exchange behaves similarly to 'amq.rabbitmq.log': everything gets published there; if you don't trust a user with the information that gets published, don't allow them access.

Installation

With RabbitMQ 3.6.0 or Later

Most recent RabbitMQ version ships with this plugin. As of RabbitMQ 3.6.0 this plugin is included into the RabbitMQ distribution.

Enable it with the following command:

rabbitmq-plugins enable rabbitmq_event_exchange

With RabbitMQ 3.5.x

You can download a pre-built binary of this plugin from the RabbitMQ Community Plugins page.

Then run the following command:

rabbitmq-plugins enable rabbitmq_event_exchange

Event format

Each event has various properties associated with it. These are translated into AMQP 0-9-1 data encoding and inserted in the message headers. The message body is always blank.

Events

So far RabbitMQ and related plugins emit events with the following routing keys:

RabbitMQ Broker

Queue, Exchange and Binding events:

  • queue.deleted
  • queue.created
  • exchange.created
  • exchange.deleted
  • binding.created
  • binding.deleted

Connection and Channel events:

  • connection.created
  • connection.closed
  • channel.created
  • channel.closed

Consumer events:

  • consumer.created
  • consumer.deleted

Policy and Parameter events:

  • policy.set
  • policy.cleared
  • parameter.set
  • parameter.cleared

Virtual host events:

  • vhost.created
  • vhost.deleted
  • vhost.limits.set
  • vhost.limits.cleared

User related events:

  • user.authentication.success
  • user.authentication.failure
  • user.created
  • user.deleted
  • user.password.changed
  • user.password.cleared
  • user.tags.set

Permission events:

  • permission.created
  • permission.deleted
  • topic.permission.created
  • topic.permission.deleted

Alarm events:

  • alarm.set
  • alarm.cleared

Shovel Plugin

Worker events:

  • shovel.worker.status
  • shovel.worker.removed

Federation Plugin

Link events:

  • federation.link.status
  • federation.link.removed

Example

There is a usage example using the Java client in examples/java.

Configuration

  • rabbitmq_event_exchange.vhost: what vhost should the amq.rabbitmq.event exchange be declared in. Default: rabbit.default_vhost (<<"/">>).

Uninstalling

If you want to remove the exchange which this plugin creates, first disable the plugin and restart the broker. Then you can delete the exchange, e.g. with :

rabbitmqctl eval 'rabbit_exchange:delete(rabbit_misc:r(<<"/">>, exchange, <<"amq.rabbitmq.event">>), false).'

Building from Source

Building is no different from building other RabbitMQ plugins.

TL;DR:

git clone https://github.com.com/rabbitmq/rabbitmq-public-umbrella.git umbrella
cd umbrella
make co
make up BRANCH=stable
cd deps
git clone https://github.com/rabbitmq/rabbitmq-event-exchange.git rabbitmq_event_exchange
cd rabbitmq_event_exchange
make dist

License

Released under the Mozilla Public License 2.0, the same as RabbitMQ.

rabbitmq-event-exchange's People

Contributors

acogoluegnes avatar dcorbacho avatar dumbbell avatar gerhard avatar gmr avatar hairyhum avatar kjnilsson avatar lukebakken avatar magec avatar michaelklishin avatar spring-operator avatar swagataroy avatar videlalvaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rabbitmq-event-exchange's Issues

amq.rabbitmq.event remains after plugin disabling

If you decide at some point you don't need that plugin anymore and disable it, the exchange amq.rabbitmq.event remains in rabbitmq and it's impossible to remove it:

2018-08-17 12:25:40.940 [info] <0.22789.0> Stopping RabbitMQ applications and their dependencies in the following order:
    rabbitmq_event_exchange
2018-08-17 12:25:40.941 [info] <0.22789.0> Stopping application 'rabbitmq_event_exchange'
2018-08-17 12:25:40.941 [info] <0.31.0> Application rabbitmq_event_exchange exited with reason: stopped
2018-08-17 12:25:40.951 [info] <0.22789.0> Plugins changed; disabled [rabbitmq_event_exchange]
2018-08-17 12:25:56.056 [warning] <0.22801.0> Delete exchange error: deletion of system exchange 'amq.rabbitmq.event' in vhost '/' not allowed

user.authentication.success has vhost set to 'none' and is misleading

I have simple test case in C# - user connects to virtual host called vhost:

    var factory = new ConnectionFactory
    {
        UserName = "username",
        Password = "password",
        VirtualHost = "vhost"
    };

    using (var connection = factory.CreateConnection())
    {
        Check.That(connection).IsNotNull();
    }

It works okay but event published has property vhost with value none:

Exchange    amq.rabbitmq.event
Routing Key     user.authentication.success
Properties  
  timestamp:    1459239111949
  delivery_mode:    2
  headers:  
    connection_type:    network
    name:   username
    host:   {0,0,0,0,0,0,0,1}
    vhost:  none
    connection_name:    [::1]:54155 -> [::1]:5672
    peer_host:  {0,0,0,0,0,0,0,1}
    peer_port:  54155
    protocol:   {0,9,1}
    auth_mechanism: PLAIN
    ssl:    false

but it should reflect host that user is connected to. It has been checked on RabbitMQ 3.6.0.

Add vhost information to the policy.* events

The client has a large number of vhosts and want to process policy events (policy.set & policy.cleared) per vhost. Right now it is not possible because these events do not carry a vhost attribute.

Is it possible to add vhost information to these events?

Non-compliant timestamp format in content header?

A user of the Haigha AMQP client library reported getting the value of the timestamp in microseconds in the content header from rabbitmq-event-exchange - see agoragames/haigha#88 (comment) .

I also came across this complaint about the same problem in another amqp client: bakkerthehacker/bramqp#44

If that user is correct, it would mean that rabbitmq-event-exchange plugin is violating the amqp0-9-1 specification that defines the timestamp to be a 64-bit "POSIX time_t", which is expressed in seconds (not microseconds).

Deviating from the AMQP spec breaks client implementations and/or interferes with their timestamp format parsing/validation logic. A safe alternative would be to place the higher-resolution timestamp value as a property in the headers table along with the other Props.

I also posted a question about this in https://groups.google.com/forum/#!topic/rabbitmq-users/_4ZRm8vX73g

Add high-resolution event timestamp to event info in application headers

PR #11 restored the frame header's timestamp to second-level resolution for compliance with AMQP specification per issue #8.

Since high-resolution event timestamps are important for debugging, a high-resolution timestamp should be added to the event info in application headers, where it won't conflict with AMQP spec, along with appropriate documentation. Need to pick a sensible name for the new timestamp.

Client detection

Hi,
Can I detect which client just 'connected' or 'disconnected'
I tried consumerTag but It doesnot work @@
Thanks

plugin seem doesn't working

I installed rabbitmq_event_exchange on ubuntu by
1. downloaded: rabbitmq_event_exchange-3.3.x-12eef624.ez,
2. put it into dir: /rabbitmq_server-3.3.4/plugins
3. enabled it by command: rabbitmq-pluings enable rabbitmq_event_exchange

and that was no exchange "amq.rabbitmq.event", what's wrong, please give me some suggestions.

Plugin doesn't provide a new style configuration schema

I am configuring RabbitMQ with the rabbitmq_event_exchange plugin to listen to RabbitMQ queue creation events. By default, the plugin is creating an exchange named 'amq.rabbitmq.event' in the default vhost(/) . But, I am trying to change vhost to 'test' (custom vhost created by me) As per the instructions from the plugin page, I added a property rabbitmq_event_exchange.vhost= test in my rabbitmq.conf file. But, the plugin doesn't provide a new style configuration schema, so it didn't worked. I am allowed to use only classic config format.

Ref: https://groups.google.com/forum/#!topic/rabbitmq-users/Z7_5WGc2ubE

Username on connection.closed?

Would it be possible for you to add the username to connection.closed events in the same way as is the case for connection.created?

Queue process is weird state after upgrade to 3.6.2

After an upgrade from 3.5.3 we faced an bug with event exchange plugin.

We always keep a queue connected to creation/destroy events using the plugin. That queue is set to durable and is a mirror queue. It has several consumers connected to it.

The thing was that, after an upgrade, that queue went to a corrupt state, we could neither delete it ,nor consume from it. The counters in the management console went to NaN, etc. We fixed the issue by getting the node where the queue was allocated out of the cluster. Deleting its mnesia files and rejoining the cluster. We though it was just a thing related to rabbit upgrade, but after a restart, it happened again. I cannot reproduce the issue in our staging environments. This lead us to downgrade and go back to 3.5.3.

Capture id of the user taking the action

This is necessary for audit control/change log.

Example for deleting a queue:

Exchange    amq.rabbitmq.event
Routing Key queue.deleted
Redelivered โ—‹
Properties  
timestamp:  1454028844518415
delivery_mode:  2
headers:    
name:   adadawd
vhost:  /
Payload
0 bytes
Encoding: string

There is no user id.

On 3.3.1 Not Working

I enabled this plugin in RabbitMQ 3.3.1 on a Windows server.
But it doesn't seem to be working. On the management web ui, for the Exchange: amq.rabbitmq.event, it shows ... no publishes ...

Node fails to start when custom virtual host is used

I want to change the virtual host of this exchange to dev so I have added this line to rabbitmq.conf:

rabbitmq_event_exchange.vhost = dev

I have also tried this (same outcome):

event_exchange.vhost = dev

After that, my server will not start anymore, failing with:

erl_crash.dump

=erl_crash_dump:0.5
Wed Oct 30 16:03:19 2019
Slogan: init terminating in do_boot (generate_config_file)
System version: Erlang/OTP 22 [erts-10.5] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:64]
Compiled: Tue Sep 17 10:26:36 2019
Taints:
Atoms: 10909
Calling Thread: scheduler:1
=scheduler:1
....

No other logs are updated.

Plugin Version: rabbitmq_event_exchange 3.7.18
Rabbitmq Version: 3.7.18
Erlang Version: 22.1
OS: Windows Server 2016

Passcode from STOMP CONNECT frame

Hello, I'd like to know if also STOMP CONNECT passcode header can be propagated via RabbitMQ event exchange plugin to a connected consumer, e.g. as a part of connection.* or user.authentication.* events. If not supported by default, is it possible to modify the plugin to allow this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.