The Event Context

There are three methods available to register an event:

public static UUID registerEvent(int priority, Lifetime lifetime, ErrorPolicy errorPolicy, String eventName, Predicate<Index> resourcePredicate, Event<JsonElement> event);
public static <T> UUID registerEvent(MixsonCodec<T> codec, int priority, Lifetime lifetime, ErrorPolicy errorPolicy, String eventName, Predicate<Index> resourcePredicate, Event<T> event);
public static <T> UUID registerEvent(MixsonEventBuilder<T> builder);

In terms of the differences between the methods, the first registration method is specifically for events operating on Json files. The second method is the most flexible since a MixsonCodec can be used to register an event for any type of resource. MixsonCodecs are explained in the advanced section. The third method only takes in a MixsonEventBuilder,which does exactly as the name implies. This method exists to help users programmatically register events.

The priority parameter determines the order in which events are processed. The lower the number, the earlier the event is processed.

The lifetime parameter and errorPolicy parameters were explained eariler.

The eventName parameter is the name of the event. The name does not affect the event itself and is purely for identifying the event in the log when a debug option is enabled.

The resourcePredicate parameter is a predicate that determines whether the event should be processed for a given resource.

The event parameter is the event itself.