Package org.apache.camel

Examples of org.apache.camel.CamelTemplate


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


                    return endpoint.createProducer();
                } catch (Exception e) {
                    throw new RuntimeCamelException(e);
                }
            } else if (type.isAssignableFrom(CamelTemplate.class)) {
                return new CamelTemplate(getCamelContext(), endpoint);
            }
        }
        return null;
    }
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 CamelTemplate(context, endpoint);
            }
        }
        return new CamelTemplate(context);
    }
View Full Code Here

            if (type.isInstance(endpoint)) {
                return endpoint;
            } else if (type.isAssignableFrom(Producer.class)) {
                return createInjectionProducer(endpoint);
            } else if (type.isAssignableFrom(CamelTemplate.class)) {
                return new CamelTemplate(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



    public void testBeanHasCamelTemplateInjected() throws Exception {
        assertNotNull("Bean should be injected", bean);
        CamelTemplate template = bean.getTemplate();
        assertNotNull("Bean should have a CamelTemplate", template);

        endpoint.expectedBodiesReceived(body);

        template.sendBody(body);

        endpoint.assertIsSatisfied();
    }
View Full Code Here

        MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
        resultEndpoint.expectedMessageCount(1);
        resultEndpoint.expectedBodiesReceived(allBrothers);

        CamelTemplate template = new CamelTemplate(context);
        template.sendBody("direct:start", allNames);

        assertMockEndpointsSatisifed();
    }
View Full Code Here

        BasicConfigurator.configure();
        Logger.getRootLogger().setLevel(Level.DEBUG);
*/
        context = new DefaultCamelContext();
        context.start();
        template = new CamelTemplate(context);
    }
View Full Code Here

                catch (Exception e) {
                    throw new RuntimeCamelException(e);
                }
            }
            else if (type.isAssignableFrom(CamelTemplate.class)) {
                return new CamelTemplate(getCamelContext(), endpoint);
            }
        }
        return null;
    }
View Full Code Here

            }
        });
        // END SNIPPET: e3
        // Camel template - a handy class for kicking off exchanges
        // START SNIPPET: e4
        CamelTemplate template =new CamelTemplate(context);
        // END SNIPPET: e4
        // Now everything is set up - lets start the context
        context.start();
        // now send some test text to a component - for this case a JMS Queue
        // The text get converted to JMS messages - and sent to the Queue test.queue
        // The file component is listening for messages from the Queue test.queue, consumes
        // them and stores them to disk. The content of each file will be the test test we sent here.
        // The listener on the file component gets notfied when new files are found ...
        // that's it!
        // START SNIPPET: e5
        for(int i=0;i<10;i++){
            template.sendBody("test-jms:queue:test.queue","Test Message: "+i);
        }
        // END SNIPPET: e5
        Thread.sleep(1000);
        context.stop();
    }
View Full Code Here

            }
        });
        // END SNIPPET: e3
        // Camel template - a handy class for kicking off exchanges
        // START SNIPPET: e4
        CamelTemplate template = new CamelTemplate(context);
        // END SNIPPET: e4
        // Now everything is set up - lets start the context
        context.start();
        // now send some test text to a component - for this case a JMS Queue
        // The text get converted to JMS messages - and sent to the Queue
        // test.queue
        // The file component is listening for messages from the Queue
        // test.queue, consumes
        // them and stores them to disk. The content of each file will be the
        // test test we sent here.
        // The listener on the file component gets notfied when new files are
        // found ...
        // that's it!
        // START SNIPPET: e5
        for (int i = 0; i < 10; i++) {
            template.sendBody("test-jms:queue:test.queue", "Test Message: " + i);
        }
        // END SNIPPET: e5
        Thread.sleep(1000);
        context.stop();
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.CamelTemplate

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.