Spring Boot Web Flux with JOOQ for interfacing with DB and Kotlin coroutines to make blocking JDBC calls run asynchronously. Now with rsockets.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
683 B

  1. package com.example.demo.controller
  2. import com.example.demo.service.UserService
  3. import kotlinx.coroutines.coroutineScope
  4. import org.springframework.messaging.handler.annotation.DestinationVariable
  5. import org.springframework.messaging.handler.annotation.MessageMapping
  6. import org.springframework.stereotype.Component
  7. @Component
  8. class RsocketDemoController(private val userService: UserService) {
  9. @MessageMapping("messages.findAll")
  10. suspend fun all() = coroutineScope {
  11. userService.getAllMessages()
  12. }
  13. @MessageMapping("users.{name}")
  14. suspend fun getUser(@DestinationVariable name: String) = coroutineScope {
  15. userService.getUserByName(name)
  16. }
  17. }