Class StreamingService
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if a new stream can be createdgetName()voidinit()Initializes the streaming service after CDI construction.voidprepareStream(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.voidprocess()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
-
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 identifierstrUserId- the user identifiereventSink- the SSE event sinksse- 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
- Specified by:
getNamein interfacefr.paris.lutece.portal.service.util.LuteceService
-
process
public void process()- Specified by:
processin interfacefr.paris.lutece.portal.service.init.ShutdownService
-
prepareStream
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 identifierstrUserId- the user who asked for the streamtask- the task producing the stream events
-