Package org.apache.camel.impl

Examples of org.apache.camel.impl.DefaultProducerTemplate


        if (defaultEndpoint != null) {
            Endpoint endpoint = context.getEndpoint(defaultEndpoint);
            if (endpoint == null) {
                throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
            } else {
                return new DefaultProducerTemplate(context, endpoint);
            }
        }
        return new DefaultProducerTemplate(context);
    }
View Full Code Here


            if (type.isInstance(endpoint)) {
                return endpoint;
            } else if (type.isAssignableFrom(Producer.class)) {
                return createInjectionProducer(endpoint);
            } else if (type.isAssignableFrom(DefaultProducerTemplate.class)) {
                return new DefaultProducerTemplate(getCamelContext(), endpoint);
            } else if (type.isAssignableFrom(PollingConsumer.class)) {
                return createInjectionPollingConsumer(endpoint);
            } else {
                throw new IllegalArgumentException("Invalid type: " + type.getName() + " which cannot be injected via @EndpointInject for " + endpoint);
            }
View Full Code Here

            }
        });
        context.start();

        final ProducerTemplate template = new DefaultProducerTemplate(context);
        template.start();

        final String[] values = { "<hello/>", "<hallo/>", "<bonjour/>" };
        final Random rnd = new Random();

        for (int i = 0; i < 100; i++) {
            template.sendBody("direct:a", values[rnd.nextInt(values.length)]);
        }
        profiler.reset();

        long t0 = System.nanoTime();
        int nbThreads = 10;
        final CountDownLatch latch = new CountDownLatch(nbThreads);
        for (int t = 0; t < nbThreads; t++) {
            new Thread() {
                public void run() {
                    for (int i = 0; i < 1000; i++) {
                        template.sendBody("direct:a", values[rnd.nextInt(values.length)]);
                    }
                    latch.countDown();
                }
            }.start();
        }
View Full Code Here

        if (defaultEndpoint != null) {
            Endpoint endpoint = context.getEndpoint(defaultEndpoint);
            if (endpoint == null) {
                throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint);
            } else {
                template = new DefaultProducerTemplate(context, endpoint);
            }
        } else {
            template = new DefaultProducerTemplate(context);
        }

        // set custom cache size if provided
        if (maximumCacheSize != null) {
            template.setMaximumCacheSize(maximumCacheSize);
View Full Code Here

TOP

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

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.