Constretto Camel Component

An Apache Camel component for Constretto bringing the awesomeness of Constretto to Camel

License

License

ASF v2 License
GroupId

GroupId

org.constretto
ArtifactId

ArtifactId

constretto-camel
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Constretto Camel Component
An Apache Camel component for Constretto bringing the awesomeness of Constretto to Camel
Project URL

Project URL

https://github.com/constretto/constretto-camel
Source Code Management

Source Code Management

http://github.com/constretto/constretto-camel

Download constretto-camel

How to add to project

<!-- https://jarcasting.com/artifacts/org.constretto/constretto-camel/ -->
<dependency>
    <groupId>org.constretto</groupId>
    <artifactId>constretto-camel</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.constretto/constretto-camel/
implementation 'org.constretto:constretto-camel:1.0.0'
// https://jarcasting.com/artifacts/org.constretto/constretto-camel/
implementation ("org.constretto:constretto-camel:1.0.0")
'org.constretto:constretto-camel:jar:1.0.0'
<dependency org="org.constretto" name="constretto-camel" rev="1.0.0">
  <artifact name="constretto-camel" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.constretto', module='constretto-camel', version='1.0.0')
)
libraryDependencies += "org.constretto" % "constretto-camel" % "1.0.0"
[org.constretto/constretto-camel "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.constretto : constretto-core jar 2.1.4
org.apache.camel : camel-core jar 2.12.2
org.apache.commons : commons-lang3 jar 3.1

test (8)

Group / Artifact Type Version
org.ini4j : ini4j jar 0.5.2
org.constretto : constretto-spring jar 2.1.4
junit : junit jar 4.11
org.mockito : mockito-all jar 1.9.5
org.slf4j : slf4j-simple jar 1.7.5
org.slf4j : jcl-over-slf4j jar 1.7.5
org.apache.camel : camel-spring-javaconfig jar 2.12.2
org.apache.camel : camel-test-spring jar 2.12.2

Project Modules

There are no modules declared in this project.

Constretto Camel

Apache Camel component supported for Constretto. Builds upon the PropertiesComponent distributed with Apache Camel. Enables you to use the power of Constretto to setup configuration from various sources such as Java properties and INI files with support for environment tagging.

Build Status

Adding to project

The component is deployed in the Sonatype repo and should thus be widely available.

Maven

<dependency>
  <groupId>org.constretto</groupId>
  <artifactId>constretto-camel</artifactId>
  <version>1.0.0</version>
</dependency>

Adding to Camel Context

Spring XML

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring" xmlns:to="http://camel.apache.org/schema/spring"
       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">

    <bean id="properties" class="org.constretto.camel.ConstrettoComponent">
        <constructor-arg>
            <array>
                <value>classpath:test.properties</value>
            </array>
        </constructor-arg>
    </bean>

    <camel:camelContext id="testContext" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:input"/>
            <to uri="log:{{outlogger}}" id="output"/>
        </route>

    </camel:camelContext>

</beans>

Or you can combine it with the Constretto-Spring XML namespace support

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xmlns:constretto="http://constretto.org/schema/constretto"
       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
       http://constretto.org/schema/constretto http://constretto.org/schema/constretto/constretto-1.2.xsd">

    <constretto:configuration>
        <constretto:stores>
            <constretto:properties-store>
                <constretto:resource location="classpath:test.properties" />
            </constretto:properties-store>
        </constretto:stores>
    </constretto:configuration>

    <bean id="properties" class="org.constretto.camel.ConstrettoComponent">
        <constructor-arg>
            <array>
                <value>ref:constretto:constrettoConfiguration</value> 
                <!-- ref: links will be looked up from the Spring context -->
            </array>
        </constructor-arg>
    </bean>

    <camel:camelContext id="testContext" xmlns="http://camel.apache.org/schema/spring">
        <route>
            <from uri="direct:input"/>
            <to uri="log:{{outlogger}}" id="output"/>
        </route>

    </camel:camelContext>

</beans>

Spring Java Context

@Configuration
public static class Context extends SingleRouteCamelConfiguration {

    @Bean
    public static ConstrettoConfiguration constrettoConfiguration() {
        return new ConstrettoBuilder(false)
                .createPropertiesStore()
                .addResource(Resource.create("classpath:test.properties"))
                .done()
                .getConfiguration();
    }

    @Bean
    public ConstrettoComponent properties() {
        return new ConstrettoComponent("ref:constrettoConfiguration");
    }

    @Override
    protected void setupCamelContext(final CamelContext camelContext) throws Exception {
        camelContext.addComponent("properties", properties());
    }

    @Override
    public RouteBuilder route() {
        return new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("direct:input").routeId("javaContextInputRoute").to("log:{{outlogger}}");
            }
        };
    }
}
org.constretto

Constretto

Versions

Version
1.0.0