java.lang.Object
org.nanonative.nano.helper.event.model.Event

public class Event extends Object
  • Field Details

    • channelId

      protected int channelId
    • createdAtMs

      protected final long createdAtMs
    • context

      protected final Context context
    • responseListener

      protected final Consumer<Object> responseListener
    • payload

      protected final Object payload
    • cache

      protected berlin.yuna.typemap.model.TypeMap cache
    • response

      protected Object response
    • error

      protected Throwable error
    • EVENT_ORIGINAL_CHANNEL_ID

      public static final String EVENT_ORIGINAL_CHANNEL_ID
      See Also:
  • Constructor Details

    • Event

      public Event(int channelId, Context context, Object payload, Consumer<Object> responseListener)
      Constructs an instance of the Event class with specified type, context, payload, and response listener. This event object can be used to trigger specific actions or responses based on the event type and payload.
      Parameters:
      channelId - The integer representing the type of the event. This typically corresponds to a specific kind of event.
      context - The Context in which the event is created and processed. It provides environmental data and configurations.
      payload - The data or object that is associated with this event. This can be any relevant information that needs to be passed along with the event.
      responseListener - A consumer that handles the response of the event processing. It can be used to execute actions based on the event's outcome or data.
  • Method Details

    • name

      public String name()
    • nameOrg

      public String nameOrg()
    • nano

      public Nano nano()
    • channelId

      public int channelId()
    • channelIdOrg

      public int channelIdOrg()
    • channelId

      public Event channelId(int channelId)
    • createdAtMs

      public long createdAtMs()
    • ifPresent

      public Event ifPresent(int channelId, Consumer<Event> consumer)
    • ifPresentAck

      public Event ifPresentAck(int channelId, Consumer<Event> consumer)
    • ifPresent

      public <T> Event ifPresent(int channelId, Class<T> clazz, Consumer<T> consumer)
    • ifPresentAck

      public <T> Event ifPresentAck(int channelId, Class<T> clazz, Consumer<T> consumer)
    • logger

      public NanoLogger logger()
    • payload

      public Object payload()
    • isAcknowledged

      public boolean isAcknowledged()
    • payloadOpt

      public Optional<Object> payloadOpt()
    • payload

      public <T> T payload(Class<T> type)
    • payloadOpt

      public <T> Optional<T> payloadOpt(Class<T> type)
    • context

      public Context context()
    • responseListener

      public Consumer<Object> responseListener()
    • acknowledge

      public Event acknowledge()
    • acknowledge

      public Event acknowledge(Runnable response)
    • response

      public Event response(Object response)
    • response

      public <T> T response(Class<T> type)
    • responseOpt

      public <T> Optional<T> responseOpt(Class<T> type)
    • response

      public Object response()
    • peek

      public Event peek(Consumer<Event> peek)
    • put

      public Event put(Object key, Object value)
    • cache

      public Event cache(Object key, Object value)
    • cache

      public berlin.yuna.typemap.model.TypeMap cache()
    • error

      public Throwable error()
    • error

      public Event error(Throwable error)
    • toString

      public String toString()
      Overrides:
      toString in class Object