Class SseEvent.Builder

java.lang.Object
io.helidon.http.sse.SseEvent.Builder
All Implemented Interfaces:
Builder<SseEvent.Builder,SseEvent>, Supplier<SseEvent>
Enclosing class:
SseEvent

public static class SseEvent.Builder extends Object implements Builder<SseEvent.Builder,SseEvent>
Fluent API builder for SseEvent.
  • Method Details

    • build

      public SseEvent build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<SseEvent.Builder,SseEvent>
      Returns:
      instance of the built type
    • id

      public SseEvent.Builder id(String id)
      Set the event id. Optional.
      Parameters:
      id - the id
      Returns:
      updated builder instance
    • name

      public SseEvent.Builder name(String name)
      Set event name. Optional.
      Parameters:
      name - event name
      Returns:
      updated builder instance
    • comment

      public SseEvent.Builder comment(String comment)
      Set comment string associated with the event. Optional. The comment will be serialized with the event, before event data is serialized.
      Parameters:
      comment - comment string
      Returns:
      updated builder instance
    • mediaType

      public SseEvent.Builder mediaType(MediaType mediaType)
      Set the media type for the event data. Default value is MediaTypes.TEXT_PLAIN.
      Parameters:
      mediaType - media type of event data
      Returns:
      updated builder instance
    • data

      public SseEvent.Builder data(Object data)
      Set event data.
      Parameters:
      data - event data
      Returns:
      updated builder instance
    • reconnectDelay

      public SseEvent.Builder reconnectDelay(Duration reconnectMillis)
      Set reconnection delay that indicates how long the event receiver should wait before attempting to reconnect in case a connection is lost. Optional.
      Parameters:
      reconnectMillis - reconnection delay
      Returns:
      updated builder instance
    • mediaContext

      public SseEvent.Builder mediaContext(MediaContext mediaContext)
      Set the media context for this event. This is only required for deserialization of events.
      Parameters:
      mediaContext - the media context
      Returns:
      updated builder instance
      See Also: