Class WicaStreamCreateController

java.lang.Object
ch.psi.wica.controllers.WicaStreamCreateController

@RestController @RequestMapping("/ca/streams") class WicaStreamCreateController extends Object
Provides a SpringBoot REST Controller to handle POST operations on the {code /ca/streams} endpoint.
  • Constructor Details

    • WicaStreamCreateController

      public WicaStreamCreateController(@Autowired WicaStreamLifecycleService wicaStreamLifecycleService, @Autowired StatisticsCollectionService statisticsCollectionService)
      Constructs a new controller for handling stream POST requests.
      Parameters:
      wicaStreamLifecycleService - reference to the service object which can be used to create the reactive stream.
      statisticsCollectionService - an object which will collect the statistics associated with this class instance.
  • Method Details

    • create

      @PostMapping(consumes="application/json", produces="text/plain") public org.springframework.http.ResponseEntity<String> create(@RequestBody(required=false) Optional<String> optJsonStreamConfiguration, jakarta.servlet.http.HttpServletRequest httpServletRequest)
      Handles an HTTP request to CREATE a new stream to monitor the the wica channels specified in the JSON stream configuration. When successful the HTTP response includes the ID of the stream which was created. This can be used in subsequent stream GET requests to subscribe to an event stream which tracks the evolving status of the channels.
      Parameters:
      optJsonStreamConfiguration - JSON string providing the stream configuration.
      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 create operation completes successfully or 'Bad Request' (= 400) if some error occurs. When successful the body of the HTTP response contains the ID of the stream which was created. When unsuccessful an additional response header 'X-WICA-ERROR' is written with a more detailed description of the error.
    • handleException

      @ExceptionHandler(java.lang.Exception.class) public void handleException(Exception ex)