Azure / Azure/fetch-event-source

503 RECEIVED

Open
#25 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.9k
Forks
196
PR merge metrics
No merged PRs in 30d

Description

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 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()));

}
}

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.