Skip to content

Commit

Permalink
added flux endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr.suwala committed Dec 21, 2023
1 parent 5dfefbf commit 750fb6b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@

Frontend is available at [http://localhost:3000/](http://localhost:3000/)
Backend is available at [http://localhost:8080/](http://localhost:8080/)

## SWAGGER

http://localhost:8080/swagger-ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ import org.axonframework.messaging.MetaData
import org.axonframework.messaging.responsetypes.ResponseType
import org.axonframework.messaging.responsetypes.ResponseTypes
import org.axonframework.queryhandling.QueryGateway
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController
import reactor.core.publisher.Flux
import java.time.Duration
import java.util.*
import kotlin.reflect.KClass

Expand Down Expand Up @@ -47,6 +50,12 @@ class OrganisationController(
)
.await()
.let { UserOrganisationViewModel(it) }

@GetMapping(path = ["/stream"], produces = [MediaType.TEXT_EVENT_STREAM_VALUE])
fun testServerSentEvents(user: Party.User): Flux<UserOrganisationViewModel> {
return Flux.interval(Duration.ofMillis(1000))
.map { UserOrganisationViewModel(listOf(UserOrganisationsView(UUID.randomUUID(), "xD"))) }
}
}

suspend fun EventBus.awaitingEvent(eventType: KClass<*>, block: suspend (correlationId: String) -> Unit) {
Expand Down

0 comments on commit 750fb6b

Please sign in to comment.