How can i configure ratpack to use this number of thread?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How can i configure ratpack to use this number of thread?

ankit8051
Hello All, I have started to learn ratpack and spring integration. I want to know, how we can start the ratpack server using some specific configuration. I have read some where that we can create the server config using ServerConfigBuilder. Can someone please let me know how we can create that configuration?
rus
Reply | Threaded
Open this post in threaded view
|

Re: How can i configure ratpack to use this number of thread?

rus
in java it would be like

    public static void main(String... args) throws Exception {
        RatpackServer.start(s -> s
            .serverConfig(c -> c
                .baseDir(BaseDir.find())
                .threads(1)
            )
            .handlers(c -> c
                .all(ctx -> ctx.render(String.valueOf(ctx.get(ServerConfig.class).getThreads())))
            ));
    }

and groovy

    ratpack {
        serverConfig {
            threads(1)
        }
        handlers {
            all {
                ....
            }
        }
    }
Reply | Threaded
Open this post in threaded view
|

Re: How can i configure ratpack to use this number of thread?

ankit8051
Thanks rus,

I am using spring boot and ratpack togather and use @EnableRatpack annotation for ratpack.

Is there any way to configure thread count in spring boot?

 
rus
Reply | Threaded
Open this post in threaded view
|

Re: How can i configure ratpack to use this number of thread?

rus
I haven't got an example but it looks like you just need to use RatpackProperties and set maxThreads
https://github.com/ratpack/ratpack/blob/master/ratpack-spring-boot/src/main/java/ratpack/spring/config/RatpackProperties.java

Let me know if you can't get this working and I'll set an example up.