Package ch.psi.wica.controllers
Class WicaStreamGetController
java.lang.Object
ch.psi.wica.controllers.WicaStreamGetController
Provides a SpringBoot REST Controller to handle GET operations on the
{code /ca/streams} endpoint.
-
Constructor Summary
ConstructorsConstructorDescriptionWicaStreamGetController
(WicaStreamLifecycleService wicaStreamLifecycleService, StatisticsCollectionService statisticsCollectionService) Constructs a new controller for handling stream GET requests. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity
<reactor.core.publisher.Flux<org.springframework.http.codec.ServerSentEvent<String>>> Handles an HTTP request to GET (= subscribe to) the wica stream with the specified ID.void
-
Constructor Details
-
WicaStreamGetController
public WicaStreamGetController(@Autowired WicaStreamLifecycleService wicaStreamLifecycleService, @Autowired StatisticsCollectionService statisticsCollectionService) Constructs a new controller for handling stream GET requests.- Parameters:
wicaStreamLifecycleService
- reference to the service object which can be used to fetch the reactive streams.statisticsCollectionService
- an object which will collect the statistics associated with this class instance.
-
-
Method Details
-
get
@GetMapping(value={"","/{optStreamId}"}, produces="text/event-stream") public org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<org.springframework.http.codec.ServerSentEvent<String>>> get(@PathVariable Optional<String> optStreamId, jakarta.servlet.http.HttpServletRequest httpServletRequest) Handles an HTTP request to GET (= subscribe to) the wica stream with the specified ID.- Parameters:
optStreamId
- the ID of the stream to be subscribed to.httpServletRequest
- contextual information for the request; used for statistics collection only.- Returns:
- an HTTP response whose status code will be set to 'OK' (= 200) if the operation completes successfully or 'Bad Request' (= 400) if some error occurs. When successful the HTTP response remains open and the evolving state of the stream's channels are written to the response body as a sequence of Server Sent Events (SSE's). When unsuccessful the response header 'X-WICA-ERROR' is written with a more detailed description of the error.
-
handleException
-