Package org.apache.camel.impl

Examples of org.apache.camel.impl.DefaultProducerTemplate


        assertEquals("camel1", lookup.getCamelContext().getName());
    }

    @Test
    public void testHasTemplateCamel2() {
        DefaultProducerTemplate lookup = context1.getRegistry().lookupByNameAndType("template2", DefaultProducerTemplate.class);
        assertNotNull("Should lookup producer template", lookup);
        assertEquals("camel2", lookup.getCamelContext().getName());
    }
View Full Code Here


        // should at least take 3 sec
        mock.setMinimumResultWaitTime(3000);

        // use our own template that has a higher thread pool than default camel that uses 5
        final ExecutorService executor = Executors.newFixedThreadPool(10);
        final ProducerTemplate pt = new DefaultProducerTemplate(context, executor);
        // must start the template
        pt.start();

        final List<Future<Object>> replies = new ArrayList<Future<Object>>(20);
        for (int i = 0; i < 20; i++) {
            final Future<Object> out = pt.asyncRequestBody("disruptor:bar", "Message " + i);
            replies.add(out);
        }

        assertMockEndpointsSatisfied();

        assertEquals(20, replies.size());
        for (int i = 0; i < 20; i++) {
            final String out = (String)replies.get(i).get();
            assertTrue(out.startsWith("Bye"));
        }
        pt.stop();
        executor.shutdownNow();
    }
View Full Code Here

        return false;
    }

    @Test
    public void testRouteboxSedaAsyncRequests() throws Exception {
        template = new DefaultProducerTemplate(context);
        template.start();       
       
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from(routeboxUri)
View Full Code Here

        return false;
    }

    @Test
    public void testRouteboxDirectProducerOnlyRequests() throws Exception {
        template = new DefaultProducerTemplate(context);
        template.start();       
    
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("direct:start")
View Full Code Here

        return false;
    }

    @Test
    public void testRouteboxDirectAsyncRequests() throws Exception {
        template = new DefaultProducerTemplate(context);
        template.start();       
    
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from(routeboxUri)
View Full Code Here

        return false;
    }
   
    @Test
    public void testRouteboxUsingDefaultContextAndRouteBuilder() throws Exception {
        template = new DefaultProducerTemplate(context);
        template.start();       
       
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from(routeboxUri)
View Full Code Here

        return false;
    }
   
    @Test
    public void testRouteboxUsingDispatchMap() throws Exception {
        template = new DefaultProducerTemplate(context);
        template.start();       
       
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from(routeboxUri)
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 {
                return new DefaultProducerTemplate(context, endpoint);
            }
        }
        return new DefaultProducerTemplate(context);
    }
View Full Code Here

        assertEquals("No properties injected", properties.size(), 1);
        assertEquals("Should get the value of org.apache.camel.test", properties.get("org.apache.camel.test"), "this is a test first");
    }
   
    public void testCamelTemplates() throws Exception {
        DefaultProducerTemplate producer1 = getMandatoryBean(DefaultProducerTemplate.class, "producer1");
        assertEquals("Inject a wrong camel context", producer1.getContext().getName(), "camel1");
       
        DefaultProducerTemplate producer2 = getMandatoryBean(DefaultProducerTemplate.class, "producer2");
        assertEquals("Inject a wrong camel context", producer2.getContext().getName(), "camel2");
    }
View Full Code Here

     * @param camelContext the context to use
     * @param endpointUri  the endpoint to invoke with the JMS message {@link Exchange}
     * @return a newly created JMS MessageListener
     */
    public static CamelMessageListener newInstance(CamelContext camelContext, String endpointUri) {
        DefaultProducerTemplate producerTemplate = DefaultProducerTemplate.newInstance(camelContext, endpointUri);
        return newInstance(camelContext, producerTemplate);
    }
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.