Set version to 3.5.0-alpha-202108041529

Change-Id: If9f900e44fdd0dea55f5eba5dba7144e69d72275
1 file changed
tree: 0237315bd65248cf875b2488b841afdaff66001e
  1. src/
  2. .gitignore
  3. BUILD
  4. Jenkinsfile
  5. LICENSE
  6. pom.xml
  7. README.md
README.md

Events Broker API for Gerrit Code Review

API of a generic events broker for use with Gerrit Code Review.

Enables the de-coupling between Gerrit, plugins and the different implementations of a generic events broker.

Stream Events Publisher

It is a quite common use case for consumers of this library to listen for Gerrit events and to stream them on a specific topic.

Since the implementation of such logic is always the same, this library provides a generic stream events publisher which will perform the relevant operations.

In order to listen and stream gerrit events, consumers of this API just need to provide a named annotation with the name of the stream events topic and then explicitly bind the Stream Events Publisher, as such:

import com.gerritforge.gerrit.eventbroker.StreamEventPublisher;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.server.events.EventListener;
import com.google.inject.AbstractModule;
import com.google.inject.TypeLiteral;
import com.google.inject.name.Names;

public class SomeModule extends AbstractModule {
    @Override
    protected void configure() {
        bind(new TypeLiteral<String>() {
        })
                .annotatedWith(Names.named(StreamEventPublisher.STREAM_EVENTS_TOPIC))
                .toInstance("name_of_the_stream_events_topic");

        DynamicSet.bind(binder(), EventListener.class).to(StreamEventPublisher.class);
    }
}

Note: To avoid message duplication Stream Events Publisher uses gerrit.instanceId and Event.instanceId to filter out forwarded events.