Hi,





I have an application using spring-boot, Apache Camel and active MQ. The
camel routes are activeMQ queue polling routes.

This is the *camel-conext.xml*

<?xml version="1.0" encoding="UTF-8"?>

<!-- Configures the Camel Context-->


<beans xmlns="http://www.springframework.org/schema/beans";

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

       xmlns:amq="http://activemq.apache.org/schema/core";

       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://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core.xsd";>


  <bean class=
"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

        <property name="locations">

            <list>


<value>file:${envpath}/activemqApplication.properties</value>


            </list>

        </property>

    </bean>



   <bean id="pooledConnectionFactory" class=
"org.apache.activemq.pool.PooledConnectionFactory" init-method="start"
destroy-method="stop">

        <property name="connectionFactory" ref="jmsConnectionFactory"/>

        <property name="maximumActiveSessionPerConnection" value=
"${message.sessions.per.connection}"/>

        <property name="maxConnections" value="${message.max.connections}"/>

    </bean>


    <bean id="jmsConnectionFactory" class=
"org.apache.activemq.ActiveMQConnectionFactory"   primary="true">

        <property name="brokerURL" value="${message.broker.url}"/>

        <property name="trustAllPackages" value="true"/>

    </bean>


    <bean id="jmsTransactionManager" class=
"org.springframework.jms.connection.JmsTransactionManager">

        <property name="connectionFactory" ref="pooledConnectionFactory"/>

    </bean>


    <bean id="activemq" class=
"org.apache.activemq.camel.component.ActiveMQComponent">

        <property name="connectionFactory" ref="pooledConnectionFactory"/>

        <property name="transactionManager" ref="jmsTransactionManager"/>

        <property name="usePooledConnection" value="true"/>

        <property name="concurrentConsumers" value="${activemq.concurrency}"
/>

    </bean>




<bean id="fileSupport" class=" com.archive.app.module.helper.filesSupport">

</bean>



  <camelContext xmlns="http://camel.apache.org/schema/spring";>

    <package>com.fileSupport.app.routes</package>


  </camelContext>


</beans>



These are the classes

Spring boot class


package com.fileSupport.app;


import org.springframework.boot.SpringApplication;


public final class FileSupportMain {


    public static void main(final String[] args) {

        SpringApplication app = new SpringApplication(
FileArchiveSpringBootApplication.class);

        app.setWebEnvironment(false);

        app.run(args);

    }


    private FileSupportMain() {

    }

}



*Spring boot main class*


package com.fileSupport.app;


import org.springframework.boot.autoconfigure.SpringBootApplication;

import org.springframework.boot.context.properties.
EnableConfigurationProperties;

import org.springframework.context.annotation.ComponentScan;

import org.springframework.context.annotation.ImportResource;


@ImportResource({"classpath:/META-INF/spring/camel-context.xml"})

@EnableConfigurationProperties


@SpringBootApplication

public  class FileSupportSpringBootApplication {

}


*Camel Routes:*



/**

 * ActiveMQ queue is watched by

 * this route which then performs content based

 * routing on the messages using XPath.

 */


@Component

public final class ConsumeActiveMQmessages extends RouteBuilder {


    @Override

    public void configure() throws Exception {



         from("activemq:queue:" + Variables.RECEIVE_QUEUE1)

             .routeId("queueRoute")


             .log(LoggingLevel.INFO, "Body: $simple{body}")

             .to("activemq:queue:" + Variables.RECEIVE_QUEUE2);


         from("activemq:queue:" + Variables.RECEIVE_QUEUE2)

         .to("direct:callback");


         from("direct:callback")


         .log(LoggingLevel.INFO, "body: $simple{body}")


         .end();


    }

}


*Application.properties*

activemq.concurrency=1

message.broker.url=failover:(tcp://localhost:61616)?maxReconnectAttempts=-1

message.sessions.per.connection=10

message.max.connections=1


*Console *

  .   ____          _            __ _ _

 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \

( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \

 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )

  '  |____| .__|_| |_|_| |_\__, | / / / /

 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::        (v1.4.1.RELEASE)


2017-01-19 21:38:26 [main] INFO  c.v.m.f.app.FileArchiveAppMain - Starting
FileArchiveAppMain on AT200104.local with PID 2743
(/Users/ajagannathan/Work/TransmissionQueue/TXQNewWorkSpace122212016/file-archive-service/file-archive-app/target/classes
started by ajagannathan in
/Users/ajagannathan/Work/TransmissionQueue/TXQNewWorkSpace122212016/file-archive-service/file-archive-app)

2017-01-19 21:38:26 [main] INFO  c.v.m.f.app.FileArchiveAppMain - No active
profile set, falling back to default profiles: default

2017-01-19 21:38:26 [main] INFO  o.s.c.a.AnnotationConfigApplicationContext
- Refreshing
org.springframework.context.annotation.AnnotationConfigApplicationContext@5939a379:
startup date [Thu Jan 19 21:38:26 PST 2017]; root of context hierarchy

2017-01-19 21:38:27 [main] INFO  o.s.b.f.xml.XmlBeanDefinitionReader -
Loading XML bean definitions from class path resource
[META-INF/spring/camel-context.xml]

2017-01-19 21:38:28 [main] INFO  o.s.b.f.c.PropertyPlaceholderConfigurer -
Loading properties file from URL
[file:/Users/ajagannathan/Work/TransmissionQueue/TXQNewWorkSpace122212016/file-archive-service/file-archive-app/src/main/resources/fileArchiveAppService.properties]

2017-01-19 21:38:28 [main] INFO
o.s.b.f.a.AutowiredAnnotationBeanPostProcessor - JSR-330
'javax.inject.Inject' annotation found and supported for autowiring

2017-01-19 21:38:28 [main] INFO
o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean
'org.apache.camel.spring.boot.CamelAutoConfiguration' of type [class
org.apache.camel.spring.boot.CamelAutoConfiguration$$EnhancerBySpringCGLIB$$77bd6f30]
is not eligible for getting processed by all BeanPostProcessors (for
example: not eligible for auto-proxying)

2017-01-19 21:38:28 [ActiveMQ Task-1] INFO
o.a.a.t.failover.FailoverTransport - Successfully connected to
tcp://localhost:61616

2017-01-19 21:38:29 [main] INFO  o.a.c.i.c.DefaultTypeConverter - Loaded
203 type converters

2017-01-19 21:38:30 [main] INFO  o.s.j.e.a.AnnotationMBeanExporter -
Registering beans for JMX exposure on startup

2017-01-19 21:38:30 [main] INFO  o.s.c.s.DefaultLifecycleProcessor -
Starting beans in phase 2147483647

2017-01-19 21:38:30 [main] INFO  o.a.c.spring.boot.RoutesCollector -
Loading additional Camel XML routes from: classpath:camel/*.xml

2017-01-19 21:38:30 [main] INFO  o.a.c.spring.boot.RoutesCollector -
Loading additional Camel XML rests from: classpath:camel-rest/*.xml

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
Apache Camel 2.18.0 (CamelContext: camel-server) is starting

2017-01-19 21:38:30 [main] INFO  o.a.c.m.ManagedManagementStrategy - JMX is
enabled

2017-01-19 21:38:30 [main] INFO  o.a.c.i.DefaultRuntimeEndpointRegistry -
Runtime endpoint registry is in extended mode gathering usage statistics of
all incoming and outgoing endpoints (cache limit: 1000)

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
StreamCaching is not in use. If using streams then its recommended to
enable stream caching. See more details at
http://camel.apache.org/stream-caching.html

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
Route: route1 started and consuming from: direct://callback

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
Route: queueRoute started and consuming from: activemq://queue:RECEIVE

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
Route: route2 started and consuming from: activemq://queue:CALLBACK

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
Total 3 routes, of which 3 are started.

2017-01-19 21:38:30 [main] INFO  o.a.camel.spring.SpringCamelContext -
Apache Camel 2.18.0 (CamelContext: camel-server) started in 0.323 seconds

2017-01-19 21:38:30 [main] INFO  c.v.m.f.app.FileArchiveAppMain - Started
FileArchiveAppMain in 4.145 seconds (JVM running for 4.586)

2017-01-19 21:38:49 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616@53828]
WARN  o.a.a.t.failover.FailoverTransport - Transport
(tcp://localhost:61616) failed , attempting to automatically reconnect: {}

java.io.EOFException: null

at java.io.DataInputStream.readInt(DataInputStream.java:392)

at
org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:267)

at
org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:240)

at
org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:232)

at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)

at java.lang.Thread.run(Thread.java:745)

2017-01-19 21:38:59 [ActiveMQ Task-2] WARN
o.a.a.t.failover.FailoverTransport - Failed to connect to
[tcp://localhost:61616] after: 10 attempt(s) continuing to retry.

2017-01-19 21:39:19 [Thread-3] INFO
o.s.c.a.AnnotationConfigApplicationContext - Closing
org.springframework.context.annotation.AnnotationConfigApplicationContext@5939a379:
startup date [Thu Jan 19 21:38:26 PST 2017]; root of context hierarchy

2017-01-19 21:39:19 [Thread-3] INFO  o.a.camel.spring.SpringCamelContext -
Apache Camel 2.18.0 (CamelContext: camel-server) is shutting down

2017-01-19 21:39:19 [Thread-3] INFO  o.a.c.impl.DefaultShutdownStrategy -
Starting to graceful shutdown 3 routes (timeout 10 seconds)

2017-01-19 21:39:29 [Thread-3] WARN  o.a.c.impl.DefaultShutdownStrategy -
Timeout occurred during graceful shutdown. Forcing the routes to be
shutdown now. Notice: some resources may still be running as graceful
shutdown did not complete successfully.

2017-01-19 21:39:29 [Camel (camel-server) thread #2 - ShutdownTask] INFO
o.a.c.impl.DefaultShutdownStrategy - Route: route2 shutdown complete, was
consuming from: activemq://queue:CALLBACK

2017-01-19 21:39:29 [Camel (camel-server) thread #2 - ShutdownTask] INFO
o.a.c.impl.DefaultShutdownStrategy - Route: queueRoute shutdown complete,
was consuming from: activemq://queue:RECEIVE

2017-01-19 21:39:29 [Camel (camel-server) thread #2 - ShutdownTask] INFO
o.a.c.impl.DefaultShutdownStrategy - Route: route1 shutdown complete, was
consuming from: direct://callback

2017-01-19 21:39:29 [Camel (camel-server) thread #1 -
JmsConsumer[CALLBACK]] WARN  o.a.c.c.j.DefaultJmsMessageListenerContainer -
Setup of JMS message listener invoker failed for destination CALLBACK' -
trying to recover. Cause: Unexpected failure.

Would appreciate your assistance.


Thanks

Reply via email to