Interface EventTriggerPredicate<T>

Type Parameters:
T - Type of event message
All Superinterfaces:
Predicate<T>
All Known Subinterfaces:
EventTriggerExtensionPredicate<T>
All Known Implementing Classes:
AnyEventTriggerPredicate

public interface EventTriggerPredicate<T> extends Predicate<T>
An event trigger predicate
Since:
2.0.0
  • 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 headers
      body - message body
      Returns:
      an event message
    • test

      boolean test(@Nullable T eventMessage)
      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 interface Predicate<T>
      Parameters:
      eventMessage - the input argument
      Returns:
      true if the event message argument matches the predicate, otherwise false
      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 by create(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 in test(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 in test(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 in test(Object).
      Be aware that the cast operation might raise the ClassCastException in runtime and then make the trigger fail to execute.
    • create

      Create an event trigger predicate by the given converter and given filter.
      Type Parameters:
      T - type of event
      Parameters:
      converter - the given message converter
      filter - the given message filter
      Returns:
      the event trigger predicate
    • create

      static <T> EventTriggerPredicate<T> create(Map<String,Object> properties)
      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: