Repository: camel Updated Branches: refs/heads/master 940fde21b -> eb8fcf9ab
CAMEL-10235: Add fluentTemplate to XML DSL Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/26639590 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/26639590 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/26639590 Branch: refs/heads/master Commit: 26639590c2f0d4c4e23327be2649b1c3df772f37 Parents: 940fde2 Author: Claus Ibsen <davscl...@apache.org> Authored: Thu Aug 11 10:57:54 2016 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Thu Aug 11 10:57:54 2016 +0200 ---------------------------------------------------------------------- ...tCamelFluentProducerTemplateFactoryBean.java | 105 +++++++++++++++++++ ...bstractCamelProducerTemplateFactoryBean.java | 5 + .../camel/spring/CamelContextFactoryBean.java | 23 ++-- .../CamelFluentProducerTemplateFactoryBean.java | 56 ++++++++++ .../spring/handler/CamelNamespaceHandler.java | 35 ++++++- .../FluentProducerTemplateAutoRegisterTest.java | 45 ++++++++ .../produce/FluentProduceTemplateTest.java | 42 ++++++++ ...ProducerTemplateAutoRegisterTest-context.xml | 28 +++++ .../FluentProduceTemplateTest-context.xml | 37 +++++++ 9 files changed, 363 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFluentProducerTemplateFactoryBean.java ---------------------------------------------------------------------- diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFluentProducerTemplateFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFluentProducerTemplateFactoryBean.java new file mode 100644 index 0000000..9db2409 --- /dev/null +++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelFluentProducerTemplateFactoryBean.java @@ -0,0 +1,105 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.core.xml; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlTransient; + +import org.apache.camel.CamelContext; +import org.apache.camel.Endpoint; +import org.apache.camel.FluentProducerTemplate; +import org.apache.camel.builder.DefaultFluentProducerTemplate; +import org.apache.camel.spi.Metadata; +import org.apache.camel.util.ServiceHelper; + +/** + * A factory for creating a new {@link org.apache.camel.FluentProducerTemplate} + * instance with a minimum of XML + * + * @version + */ +@XmlAccessorType(XmlAccessType.FIELD) +public abstract class AbstractCamelFluentProducerTemplateFactoryBean extends AbstractCamelFactoryBean<FluentProducerTemplate> { + @XmlTransient + private FluentProducerTemplate template; + @XmlAttribute @Metadata(description = "Sets the default endpoint URI used by default for sending message exchanges") + private String defaultEndpoint; + @XmlAttribute @Metadata(description = "Sets a custom maximum cache size to use in the backing cache pools.") + private Integer maximumCacheSize; + + public FluentProducerTemplate getObject() throws Exception { + CamelContext context = getCamelContext(); + if (defaultEndpoint != null) { + Endpoint endpoint = context.getEndpoint(defaultEndpoint); + if (endpoint == null) { + throw new IllegalArgumentException("No endpoint found for URI: " + defaultEndpoint); + } else { + template = new DefaultFluentProducerTemplate(context); + template.setDefaultEndpoint(endpoint); + } + } else { + template = new DefaultFluentProducerTemplate(context); + } + + // set custom cache size if provided + if (maximumCacheSize != null) { + template.setMaximumCacheSize(maximumCacheSize); + } + + // must start it so its ready to use + ServiceHelper.startService(template); + return template; + } + + public Class<DefaultFluentProducerTemplate> getObjectType() { + return DefaultFluentProducerTemplate.class; + } + + public void destroy() throws Exception { + ServiceHelper.stopService(template); + } + + // Properties + // ------------------------------------------------------------------------- + + public String getDefaultEndpoint() { + return defaultEndpoint; + } + + /** + * Sets the default endpoint URI used by default for sending message exchanges + */ + public void setDefaultEndpoint(String defaultEndpoint) { + this.defaultEndpoint = defaultEndpoint; + } + + public Integer getMaximumCacheSize() { + return maximumCacheSize; + } + + /** + * Sets a custom maximum cache size to use in the backing cache pools. + * + * @param maximumCacheSize the custom maximum cache size + */ + public void setMaximumCacheSize(Integer maximumCacheSize) { + this.maximumCacheSize = maximumCacheSize; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java ---------------------------------------------------------------------- diff --git a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java index 8690be0..6ec1685 100644 --- a/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java +++ b/components/camel-core-xml/src/main/java/org/apache/camel/core/xml/AbstractCamelProducerTemplateFactoryBean.java @@ -92,6 +92,11 @@ public abstract class AbstractCamelProducerTemplateFactoryBean extends AbstractC return maximumCacheSize; } + /** + * Sets a custom maximum cache size to use in the backing cache pools. + * + * @param maximumCacheSize the custom maximum cache size + */ public void setMaximumCacheSize(Integer maximumCacheSize) { this.maximumCacheSize = maximumCacheSize; } http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java index 16233d4..1d13c11 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java @@ -153,17 +153,18 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr @XmlElement(name = "jmxAgent", type = CamelJMXAgentDefinition.class) private CamelJMXAgentDefinition camelJMXAgent; @XmlElements({ - @XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class, required = false), - @XmlElement(name = "consulConfiguration", type = ConsulConfigurationDefinition.class, required = false), - @XmlElement(name = "dnsConfiguration", type = DnsConfigurationDefinition.class, required = false), - @XmlElement(name = "etcdConfiguration", type = EtcdConfigurationDefinition.class, required = false), - @XmlElement(name = "kubernetesConfiguration", type = KubernetesConfigurationDefinition.class, required = false), - @XmlElement(name = "ribbonConfiguration", type = RibbonConfigurationDefinition.class, required = false), - @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class, required = false), - @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class, required = false), - @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class, required = false), - @XmlElement(name = "export", type = CamelServiceExporterDefinition.class, required = false), - @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class, required = false)}) + @XmlElement(name = "hystrixConfiguration", type = HystrixConfigurationDefinition.class), + @XmlElement(name = "consulConfiguration", type = ConsulConfigurationDefinition.class), + @XmlElement(name = "dnsConfiguration", type = DnsConfigurationDefinition.class), + @XmlElement(name = "etcdConfiguration", type = EtcdConfigurationDefinition.class), + @XmlElement(name = "kubernetesConfiguration", type = KubernetesConfigurationDefinition.class), + @XmlElement(name = "ribbonConfiguration", type = RibbonConfigurationDefinition.class), + @XmlElement(name = "template", type = CamelProducerTemplateFactoryBean.class), + @XmlElement(name = "fluentTemplate", type = CamelFluentProducerTemplateFactoryBean.class), + @XmlElement(name = "consumerTemplate", type = CamelConsumerTemplateFactoryBean.class), + @XmlElement(name = "proxy", type = CamelProxyFactoryDefinition.class), + @XmlElement(name = "export", type = CamelServiceExporterDefinition.class), + @XmlElement(name = "errorHandler", type = ErrorHandlerDefinition.class)}) private List<?> beans; @XmlElement(name = "routeBuilder") private List<RouteBuilderDefinition> builderRefs = new ArrayList<RouteBuilderDefinition>(); http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/main/java/org/apache/camel/spring/CamelFluentProducerTemplateFactoryBean.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelFluentProducerTemplateFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelFluentProducerTemplateFactoryBean.java new file mode 100644 index 0000000..fecbb30 --- /dev/null +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelFluentProducerTemplateFactoryBean.java @@ -0,0 +1,56 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlTransient; + +import org.apache.camel.CamelContext; +import org.apache.camel.FluentProducerTemplate; +import org.apache.camel.core.xml.AbstractCamelFluentProducerTemplateFactoryBean; +import org.apache.camel.spring.util.CamelContextResolverHelper; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.DisposableBean; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +/** + * Configures a {@link org.apache.camel.FluentProducerTemplate} + * + * @version + */ +@XmlRootElement(name = "fluentTemplate") +@XmlAccessorType(XmlAccessType.FIELD) +public class CamelFluentProducerTemplateFactoryBean extends AbstractCamelFluentProducerTemplateFactoryBean implements FactoryBean<FluentProducerTemplate>, InitializingBean, DisposableBean, ApplicationContextAware { + + @XmlTransient + private ApplicationContext applicationContext; + + @Override + protected CamelContext getCamelContextWithId(String camelContextId) { + return CamelContextResolverHelper.getCamelContextWithId(applicationContext, camelContextId); + } + + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java index 917a3f3..945c2e9 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java @@ -50,6 +50,7 @@ import org.apache.camel.spring.CamelBeanPostProcessor; import org.apache.camel.spring.CamelConsumerTemplateFactoryBean; import org.apache.camel.spring.CamelContextFactoryBean; import org.apache.camel.spring.CamelEndpointFactoryBean; +import org.apache.camel.spring.CamelFluentProducerTemplateFactoryBean; import org.apache.camel.spring.CamelProducerTemplateFactoryBean; import org.apache.camel.spring.CamelRedeliveryPolicyFactoryBean; import org.apache.camel.spring.CamelRestContextFactoryBean; @@ -142,6 +143,7 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport { addBeanDefinitionParser("proxy", CamelProxyFactoryBean.class, true, false); addBeanDefinitionParser("template", CamelProducerTemplateFactoryBean.class, true, false); + addBeanDefinitionParser("fluentTemplate", CamelFluentProducerTemplateFactoryBean.class, true, false); addBeanDefinitionParser("consumerTemplate", CamelConsumerTemplateFactoryBean.class, true, false); addBeanDefinitionParser("export", CamelServiceExporter.class, true, false); addBeanDefinitionParser("threadPool", CamelThreadPoolFactoryBean.class, true, true); @@ -429,7 +431,7 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport { if (ObjectHelper.isNotEmpty(id)) { parserContext.registerComponent(new BeanComponentDefinition(definition, id)); // set the templates with the camel context - if (localName.equals("template") || localName.equals("consumerTemplate") + if (localName.equals("template") || localName.equals("fluentTemplate") || localName.equals("consumerTemplate") || localName.equals("proxy") || localName.equals("export")) { // set the camel context definition.getPropertyValues().addPropertyValue("camelContext", new RuntimeBeanReference(contextId)); @@ -554,10 +556,11 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport { } /** - * Used for auto registering producer and consumer templates if not already defined in XML. + * Used for auto registering producer, fluent producer and consumer templates if not already defined in XML. */ protected void registerTemplates(Element element, ParserContext parserContext, String contextId) { boolean template = false; + boolean fluentTemplate = false; boolean consumerTemplate = false; NodeList list = element.getChildNodes(); @@ -569,6 +572,8 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport { String localName = childElement.getLocalName(); if ("template".equals(localName)) { template = true; + } else if ("fluentTemplate".equals(localName)) { + fluentTemplate = true; } else if ("consumerTemplate".equals(localName)) { consumerTemplate = true; } @@ -601,6 +606,32 @@ public class CamelNamespaceHandler extends NamespaceHandlerSupport { } } + if (!fluentTemplate) { + // either we have not used fluentTemplate before or we have auto registered it already and therefore we + // need it to allow to do it so it can remove the existing auto registered as there is now a clash id + // since we have multiple camel contexts + boolean existing = autoRegisterMap.get("fluentTemplate") != null; + boolean inUse = false; + try { + inUse = parserContext.getRegistry().isBeanNameInUse("fluentTemplate"); + } catch (BeanCreationException e) { + // Spring Eclipse Tooling may throw an exception when you edit the Spring XML online in Eclipse + // when the isBeanNameInUse method is invoked, so ignore this and continue (CAMEL-2739) + LOG.debug("Error checking isBeanNameInUse(fluentTemplate). This exception will be ignored", e); + } + if (!inUse || existing) { + String id = "fluentTemplate"; + // auto create a fluentTemplate + Element templateElement = element.getOwnerDocument().createElement("fluentTemplate"); + templateElement.setAttribute("id", id); + BeanDefinitionParser parser = parserMap.get("fluentTemplate"); + BeanDefinition definition = parser.parse(templateElement, parserContext); + + // auto register it + autoRegisterBeanDefinition(id, definition, parserContext, contextId); + } + } + if (!consumerTemplate) { // either we have not used template before or we have auto registered it already and therefore we // need it to allow to do it so it can remove the existing auto registered as there is now a clash id http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/test/java/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest.java new file mode 100644 index 0000000..f04bf21 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest.java @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.config; + +import org.apache.camel.CamelContext; +import org.apache.camel.FluentProducerTemplate; +import org.apache.camel.spring.SpringRunWithTestSupport; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; + +/** + * @version + */ +@ContextConfiguration +public class FluentProducerTemplateAutoRegisterTest extends SpringRunWithTestSupport { + + @Autowired + private FluentProducerTemplate template; + + @Autowired + private CamelContext context; + + @Test + public void testHasFluentTemplate() { + assertNotNull("Should have injected a fluent producer template", template); + + FluentProducerTemplate lookup = context.getRegistry().lookupByNameAndType("fluentTemplate", FluentProducerTemplate.class); + assertNotNull("Should lookup fluent producer template", lookup); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/test/java/org/apache/camel/spring/produce/FluentProduceTemplateTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/produce/FluentProduceTemplateTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/produce/FluentProduceTemplateTest.java new file mode 100644 index 0000000..836fe62 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/produce/FluentProduceTemplateTest.java @@ -0,0 +1,42 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.spring.produce; + +import org.apache.camel.EndpointInject; +import org.apache.camel.FluentProducerTemplate; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.spring.SpringRunWithTestSupport; +import org.junit.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; + +@ContextConfiguration +public class FluentProduceTemplateTest extends SpringRunWithTestSupport { + @Autowired + protected FluentProducerTemplate producer; + + @EndpointInject(uri = "mock:result") + protected MockEndpoint result; + + @Test + public void testProducerTemplate() throws Exception { + result.expectedBodiesReceived("hello"); + // lets send a message + producer.withBody("hello").to("direct:start").send(); + result.assertIsSatisfied(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/test/resources/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest-context.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest-context.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest-context.xml new file mode 100644 index 0000000..6f3e86c --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/config/FluentProducerTemplateAutoRegisterTest-context.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <camelContext xmlns="http://camel.apache.org/schema/spring"> + </camelContext> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/26639590/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/FluentProduceTemplateTest-context.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/FluentProduceTemplateTest-context.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/FluentProduceTemplateTest-context.xml new file mode 100644 index 0000000..9d5c191 --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/produce/FluentProduceTemplateTest-context.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- START SNIPPET: example --> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + "> + + <camelContext xmlns="http://camel.apache.org/schema/spring"> + <fluentTemplate id="camelTemplate" /> + <route> + <from uri="direct:start"/> + <to uri="mock:result"/> + </route> + </camelContext> + +</beans> +<!-- END SNIPPET: example -->