Interface EventTriggerPredicate<T>
- Type Parameters:
T
- Type of event message
- All Superinterfaces:
Predicate<T>
- All Known Subinterfaces:
EventTriggerExtensionPredicate<T>
- All Known Implementing Classes:
AnyEventTriggerPredicate
An event trigger predicate
- Since:
- 2.0.0
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
static class
Declares the json key for EventTrigger predicatestatic interface
The message converterstatic interface
The message filter -
Method Summary
Modifier and TypeMethodDescriptionstatic EventTriggerPredicate<Object>
any()
Create an event trigger predicate that accepts any event to kick off a trigger.Convert message headers and body to an event message with desired type.static <T> EventTriggerPredicate<T>
create
(EventTriggerPredicate.MessageConverter<T> converter, EventTriggerPredicate.MessageFilter<T> filter) Create an event trigger predicate by the given converter and given filter.static <T> EventTriggerPredicate<T>
create
(EventTriggerPredicate.MessageFilter<T> filter) Create an event trigger predicate by the given filter.static <T> EventTriggerPredicate<T>
Deserialize the given properties to desired event trigger.static EventTriggerPredicate<Object>
Create an event trigger predicate that accepts any of the event message types to satisfy the given filter.boolean
Evaluates this predicate on the given event message.@NotNull io.vertx.core.json.JsonObject
toJson()
Serialize this predicate to json.
-
Method Details
-
convert
@Nullable T convert(@NotNull @NotNull io.vertx.core.MultiMap headers, @Nullable @Nullable Object body) Convert message headers and body to an event message with desired type.- Parameters:
headers
- message headersbody
- message body- Returns:
- an event message
-
test
Evaluates this predicate on the given event message. This output is used to determine whether event trigger is executed or not.- Specified by:
test
in interfacePredicate<T>
- Parameters:
eventMessage
- the input argument- Returns:
true
if the event message argument matches the predicate, otherwisefalse
- Throws:
EventTriggerPredicate.EventTriggerPredicateException
- in case of unmatch condition, you can throw this exception to include detailed message
-
toJson
@NotNull @NotNull io.vertx.core.json.JsonObject toJson()Serialize this predicate to json. This method aims to serialize the predicate to a json data is able to persisted in any storage. The deserialization is covered bycreate(Map)
.- Returns:
- json object
- See Also:
- API Note:
- By default, the json serialization is not support to serialize an anonymous class or lambda
-
any
Create an event trigger predicate that accepts any event to kick off a trigger.- Returns:
- the event trigger predicate
- See Also:
- API Note:
- By using this factory method, the new event trigger predicate instance uses the
message body
as a predicate argument intest(Object)
-
ignoreType
Create an event trigger predicate that accepts any of the event message types to satisfy the given filter.- Returns:
- the event trigger predicate
- See Also:
- API Note:
- By using this factory method, the new event trigger predicate instance ignores the
message body
type and uses the message body as a filter argument intest(Object)
-
create
Create an event trigger predicate by the given filter.- Type Parameters:
T
- type of event- Returns:
- the event trigger predicate
- See Also:
- API Note:
- By using this factory method, the new event trigger predicate instance casts the
message body
automatically to a desired type of event and uses the message body as a filter argument intest(Object)
.
Be aware that the cast operation might raise theClassCastException
in runtime and then make the trigger fail to execute.
-
create
static <T> EventTriggerPredicate<T> create(EventTriggerPredicate.MessageConverter<T> converter, EventTriggerPredicate.MessageFilter<T> filter) Create an event trigger predicate by the given converter and given filter.- Type Parameters:
T
- type of event- Parameters:
converter
- the given message converterfilter
- the given message filter- Returns:
- the event trigger predicate
-
create
Deserialize the given properties to desired event trigger.- Type Parameters:
T
- type of event- Parameters:
properties
- the map properties- Returns:
- the event trigger predicate
- See Also:
-