Package com.lightbend.cinnamon.event
Class Event
- java.lang.Object
-
- com.lightbend.cinnamon.event.Event
-
public abstract class Event extends java.lang.Object
AnEvent
that can be fired.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Event.Severity
All supported event severities.
-
Constructor Summary
Constructors Constructor Description Event()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
destroy()
Clean up when destroyed.void
fire(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Fire an event, when enabled, using the lazily supplied data.abstract void
fire(java.util.Map<java.lang.String,java.lang.Object> data)
Fire an event with the given structured data.void
fireLimited(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Fire an event, when enabled, using the lazily supplied data.void
fireLimited(java.util.Map<java.lang.String,java.lang.Object> data)
Fire an event with the given structured data.abstract boolean
isEnabled()
Whether this event is enabled for firing.
-
-
-
Field Detail
-
NONE
public static final Event NONE
Empty no-opEvent
.
-
-
Method Detail
-
isEnabled
public abstract boolean isEnabled()
Whether this event is enabled for firing.- Returns:
- whether this event is enabled
-
fire
public abstract void fire(java.util.Map<java.lang.String,java.lang.Object> data)
Fire an event with the given structured data.- Parameters:
data
- structured event data
-
destroy
public abstract void destroy()
Clean up when destroyed.
-
fire
public void fire(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Fire an event, when enabled, using the lazily supplied data.- Parameters:
data
- supplier of data, only accessed if event is enabled
-
fireLimited
public void fireLimited(java.util.Map<java.lang.String,java.lang.Object> data)
Fire an event with the given structured data.This can be used by events to be notified of rate limited triggers as well, to do things like counting the total number of times being fired, even if some are not sent off to the receiver.
- Parameters:
data
- structured event data
-
fireLimited
public void fireLimited(java.util.function.Supplier<java.util.Map<java.lang.String,java.lang.Object>> data)
Fire an event, when enabled, using the lazily supplied data.This can be used by events to be notified of rate limited triggers as well, to do things like counting the total number of times being fired, even if some are not sent off to the receiver.
- Parameters:
data
- supplier of data, only accessed if event is enabled
-
-