activemq

ActiveMQ logo

http://activemq.apache.org

Enterprise Integration Patterns (Camel)

Camel Components

SystemD activemq.service

# cat activemq.service
[Unit]
Description=Apache ActiveMQ
After=network-online.target

[Service]
Type=forking
WorkingDirectory=/opt/activemq/current/bin
ExecStart=/opt/activemq/current/bin/activemq start
ExecStop=/opt/activemq/current/bin/activemq stop
Restart=on-abort
User=activemq
Group=activemq

[Install]
WantedBy=multi-user.target

github.com

Camel

<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"
        xsi:schemaLocation="
     http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
">

    <camel:sslContextParameters id="sslContextParameters">
        <camel:clientParameters>
            <camel:sniHostNames>
                <camel:sniHostName>localhost</camel:sniHostName>
            </camel:sniHostNames>
        </camel:clientParameters>
        <camel:trustManagers>
            <camel:keyStore resource="/opt/activemq/conf/truststore.jks" password="#######"/>
        </camel:trustManagers>
        <camel:secureSocketProtocols>
            <camel:secureSocketProtocol>TLSv1.2</camel:secureSocketProtocol>
        </camel:secureSocketProtocols>
    </camel:sslContextParameters>

    <import resource="smtp.xml"/>

    <camelContext id="toEvent" xmlns="http://camel.apache.org/schema/spring">
        <route streamCache="true">
            <from uri="activemq:event"/>
            <setProperty propertyName="CamelCharsetName">
                <constant>UTF-8</constant>
            </setProperty>

            <to uri="activemq:eventOutDebug"/>
            <toD uri="${headers[urlTo]}"/>
        </route>
    </camelContext>

    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="connectionFactory">
            <bean class="org.apache.activemq.ActiveMQConnectionFactory">
                <property name="brokerURL" value="vm://activemq?create=false"/>
                <property name="userName" value="${activemq.username}"/>
                <property name="password" value="${activemq.password}"/>
            </bean>
        </property>
    </bean>

</beans>

github.com

Camel IMAP Mailer config
<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
       http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/osgi
       http://www.springframework.org/schema/osgi/spring-osgi.xsd
       http://activemq.apache.org/camel/schema/osgi
       http://activemq.apache.org/camel/schema/osgi/camel-osgi-1.6.0.xsd
       http://activemq.apache.org/camel/schema/spring
       http://activemq.apache.org/camel/schema/spring/camel-spring-1.6.0.xsd
       http://activemq.apache.org/camel/schema/cxfEndpoint
       http://activemq.apache.org/camel/schema/cxf/camel-cxf-1.6.0.xsd">


    <camelContext id="toMail" xmlns="http://camel.apache.org/schema/spring">
        <route streamCache="true">

            <from uri="activemq:mail"/>
            <setProperty propertyName="CamelCharsetName">
                <constant>UTF-8</constant>
            </setProperty>

            <to uri="activemq:mailOutDebug"/>
            <removeHeaders pattern="JMS*"/>
            <to uri="smtp://localhost:25?mail.smtp.auth=true&amp;mail.smtp.socketFactory.fallback=true&amp;mail.smtp.ssl.trust=%2A&amp;mail.smtp.ssl.checkserveridentity=false&amp;mail.smtp.user=USER%40localhost&amp;password=#####&amp;mail.smtp.starttls.required=true&amp;mail.smtp.starttls.enable=true&amp;debugMode=true&amp;mail.smtp.debug=true&amp;sslContextParameters=%23sslContextParameters&amp;mail.smtp.connectiontimeout=180000&amp;mail.smtp.timeout=180000&amp;mail.smtp.writetimeout=180000&amp;mail.mime.multipart.ignoreexistingboundaryparameter=true"/>
        </route>
    </camelContext>
</beans>

github.com