fetch-event-source
fetch-event-source copied to clipboard
503 RECEIVED
trafficstars
Request Headers sent Accept: application/json, text/event-stream Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSIsImtpZCI6IjJaUXBKM1VwYmpBWVhZR2FYRUpsOGxWMFRPSSJ9.eyJhdWQiOiJhcGk6Ly82MjE3YzRjYy01Mjg2LTRjMTktYjUyMi01MTEyYTRhNTlmMWMiLCJp
@Slf4j @Validated @RestController @CrossOrigin(origins = "http://localhost:3000") @RequiredArgsConstructor
public class ResourceController {
@GetMapping(value = "/event/resources/usage", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<Usage> getResourceUsage() {
Random random = new Random();
log.debug("getResourceUsage ");
return Flux.interval(Duration.ofSeconds(1))
.map(it -> new Usage(
random.nextInt(101),
random.nextInt(101),
new Date()));
}
}