java.lang.Object
fr.paris.lutece.plugins.wiki.modules.ai.service.chat.StreamingService
All Implemented Interfaces:
fr.paris.lutece.portal.service.init.ShutdownService, fr.paris.lutece.portal.service.util.LuteceService

@ApplicationScoped public class StreamingService extends Object implements fr.paris.lutece.portal.service.init.ShutdownService
Manager for Wiki AI SSE streams
  • Constructor Details

    • StreamingService

      public StreamingService()
  • Method Details

    • init

      @PostConstruct public void init()
      Initializes the streaming service after CDI construction.
    • registerSseStream

      public AutoCloseable registerSseStream(String strStreamId, String strUserId, jakarta.ws.rs.sse.SseEventSink eventSink, jakarta.ws.rs.sse.Sse sse)
      Registers an SSE stream for a given stream ID
      Parameters:
      strStreamId - the stream identifier
      strUserId - the user identifier
      eventSink - the SSE event sink
      sse - the SSE instance
      Returns:
      an AutoCloseable to unregister the stream
    • canCreateNewStream

      public boolean canCreateNewStream()
      Checks if a new stream can be created
      Returns:
      true if a new stream can be created
    • getName

      public String getName()
      Specified by:
      getName in interface fr.paris.lutece.portal.service.util.LuteceService
    • process

      public void process()
      Specified by:
      process in interface fr.paris.lutece.portal.service.init.ShutdownService
    • prepareStream

      public void prepareStream(String strStreamId, String strUserId, Runnable task)
      Keeps the task producing the events of a stream until the client of the same user opens the event stream, so that no event is sent before the client listens.
      Parameters:
      strStreamId - the stream identifier
      strUserId - the user who asked for the stream
      task - the task producing the stream events