I just pick a springboot application sample with RSocket starter :
Building, then running the runnable jar gives me the following logs :
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.1.RELEASE)
2019-12-04 09:45:20.985 INFO 12928 --- [ main] com.example.DemoApplication : Starting DemoApplication on XXX with PID 1234 (demo/target/classes started by me in ~/demo)
2019-12-04 09:45:20.987 INFO 12928 --- [ main] com.example.DemoApplication : No active profile set, falling back to default profiles: default
2019-12-04 09:45:21.761 INFO 12928 --- [ main] com.example.DemoApplication : Started DemoApplication in 1.172 seconds (JVM running for 2.378)
Process finished with exit code 0
The problem is the Springboot main thread stops immediately without waiting RSocket requests. I guess the problem is the RSocket server is not started so I tried to add a RSocket controller like this :
@Controller
public class DemoController {
@MessageMapping("retreiveSomeData")
public Mono<Data> retreiveAccount(String criteria) {
return Mono.just(new Data());
}
}
Same result^^
Anyone using RSocket with SpringBoot find a "beautiful" way to force Springboot thread to wait ?
The solution was to add an RSocket Configuration.
Just add the following application.yaml
:
# application.yaml
spring:
rsocket:
server:
port: 7000
Then the Netty server will be started on port 7000 :
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.1.RELEASE)
INFO 4472 --- [ main] com.example.DemoApplication : Starting DemoApplication on ...
INFO 4472 --- [ main] com.example.DemoApplication : No active profile set, falling back to default profiles: default
INFO 4472 --- [ main] o.s.b.rsocket.netty.NettyRSocketServer : Netty RSocket started on port(s): 7000
INFO 4472 --- [ main] com.example.DemoApplication : Started DemoApplication in 2.704 seconds (JVM running for 3.142)