Skip to content

Commit

Permalink
Ignoring not relevant events.
Browse files Browse the repository at this point in the history
  • Loading branch information
flexable777 committed Dec 29, 2023
1 parent 2846c9b commit 3b8b837
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class EventController(
@GetMapping(produces = [MediaType.TEXT_EVENT_STREAM_VALUE])
fun events(
@PathVariable("behandlingId") behandlingId: String,
): Flux<ServerSentEvent<JsonNode>> {
): Flux<ServerSentEvent<JsonNode>?> {
logger.debug("new events called for behandlingId: {}", behandlingId)

//https://docs.spring.io/spring-framework/docs/current/reference/html/web.html#mvc-ann-async-disconnects
val heartbeatStream: Flux<ServerSentEvent<JsonNode>> = Flux.interval(Duration.ofSeconds(20))
val heartbeatStream: Flux<ServerSentEvent<JsonNode>> = Flux.interval(Duration.ofSeconds(10))
.takeWhile { true }
.map { toHeartBeatServerSentEvent() }

Expand All @@ -53,7 +53,7 @@ class EventController(
.event(internalBehandlingEvent.type.name)
.data(jacksonObjectMapper().readTree(internalBehandlingEvent.data))
.build()
} else error("something is wrong")
} else null
}
.publish()

Expand Down

0 comments on commit 3b8b837

Please sign in to comment.