Package org.apache.camel.impl

Examples of org.apache.camel.impl.ThreadPoolProfileSupport


    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // create a profile for the throttler
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("myThrottler");
                profile.setMaxPoolSize(5);
                profile.setMaxQueueSize(2);
                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);
               
                from("seda:start")
                    .throttle(1).timePeriodMillis(100)
                        .asyncDelayed().executorServiceRef("myThrottler").callerRunsWhenRejected(true)
View Full Code Here


    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // create and register thread pool profile
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("myProfile");
                profile.setPoolSize(2);
                profile.setMaxPoolSize(8);
                profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);
                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                        // use our custom thread pool profile
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("custom");
                profile.setPoolSize(5);
                profile.setMaxPoolSize(15);
                profile.setKeepAliveTime(25L);
                profile.setMaxQueueSize(250);
                profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);

                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                from("direct:start").threads().executorServiceRef("custom").to("mock:result");
            }
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("custom");
                profile.setPoolSize(5);
                profile.setMaxPoolSize(15);
                profile.setKeepAliveTime(25L);
                profile.setMaxQueueSize(250);
                profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);

                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                from("direct:start").threads().executorServiceRef("custom").to("mock:result");
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("custom");
                profile.setPoolSize(5);
                profile.setMaxPoolSize(15);
                profile.setKeepAliveTime(25L);
                profile.setMaxQueueSize(250);
                profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);

                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                from("direct:start").threads().executorServiceRef("custom").to("mock:result");
            }
View Full Code Here

    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // create and register thread pool profile
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("myProfile");
                profile.setPoolSize(2);
                profile.setMaxPoolSize(8);
                profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);
                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                from("direct:start")
                    .aggregate(header("id"), new BodyInAggregatingStrategy())
                        // use our custom thread pool profile
View Full Code Here

    public void testAsyncErrorHandlerWait() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("myAsyncPool");
                profile.setPoolSize(5);
                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                errorHandler(deadLetterChannel("mock:dead")
                        .maximumRedeliveries(2)
                        .redeliveryDelay(0)
View Full Code Here

     * @throws Exception is thrown if error creating the profile
     */
    public ThreadPoolProfile asThreadPoolProfile(CamelContext context) throws Exception {
        ObjectHelper.notNull(context, "CamelContext", this);

        ThreadPoolProfileSupport answer = new ThreadPoolProfileSupport(getId());
        answer.setDefaultProfile(getDefaultProfile());
        answer.setPoolSize(CamelContextHelper.parseInteger(context, getPoolSize()));
        answer.setMaxPoolSize(CamelContextHelper.parseInteger(context, getMaxPoolSize()));
        answer.setKeepAliveTime(CamelContextHelper.parseLong(context, getKeepAliveTime()));
        answer.setMaxQueueSize(CamelContextHelper.parseInteger(context, getMaxQueueSize()));
        answer.setRejectedPolicy(getRejectedPolicy());
        answer.setTimeUnit(getTimeUnit());
        return answer;
    }
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                ThreadPoolProfile profile = new ThreadPoolProfileSupport("custom");
                profile.setPoolSize(5);
                profile.setMaxPoolSize(15);
                profile.setKeepAliveTime(25L);
                profile.setMaxQueueSize(250);
                profile.setRejectedPolicy(ThreadPoolRejectedPolicy.Abort);

                context.getExecutorServiceStrategy().registerThreadPoolProfile(profile);

                from("direct:start").threads().executorServiceRef("custom").to("mock:result");
View Full Code Here

TOP

Related Classes of org.apache.camel.impl.ThreadPoolProfileSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.