camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alistair Young <alistair.yo...@uhi.ac.uk>
Subject Re: CamelSpringTestSupport::createApplicationContext hangs
Date Tue, 05 Jul 2011 08:11:19 GMT
Hi Willem,

here's the camel-config.xml and a snippet from the test case.

this is where it hangs if a broker is already running using the same camel config:
ctx.refresh();

in other tests, if I start an ActiveMQ broker programmatically it throws an error if a broker
is already running but camel just hangs if the broker is already running.

No doubt I'm doing something wrong as I'm fairly new to camel

public class GroupwiseTest extends CamelSpringTestSupport {
  private static FileSystemXmlApplicationContext ctx = null;

  protected AbstractXmlApplicationContext createApplicationContext() {
    configFiles = new String[] {Paths.path("camel-context.xml")};
    ctx = new FileSystemXmlApplicationContext();
    ctx.setConfigLocations(configFiles);
    ctx.refresh();
    return ctx;
  }
}



<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-3.0.xsd
													 http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd
													 http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
					
  <broker xmlns="http://activemq.apache.org/schema/core"
					id="matrixBrokerID"
					brokerName="matrixBroker"
					useJmx="true"
					persistent="true"
					dataDirectory="/tmp/data">

    <messageAuthorizationPolicy>
      <bean class="uk.ac.uhi.it.matrix.security.MessageGuard" xmlns="http://www.springframework.org/schema/beans"/>
    </messageAuthorizationPolicy>

    <transportConnectors>
      <transportConnector uri="tcp://localhost:61616" />
      <transportConnector name="stomp" uri="stomp://localhost:61613"/>
    </transportConnectors>
  </broker>

  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route>
      <from uri="file:/tmp/matrix?consumer.delay=1000"/>
      <convertBodyTo type="java.lang.String"/>
      <process ref="createDomainMessageProcessor" />
      <to uri="activemq:topic:matrix"/>
    </route>

    <route>
      <from uri="activemq:topic:matrix"/>
			<transacted />
			<to uri="activemq:topic:edirectory"/>
    </route>

    <route>
      <from uri="activemq:topic:edirectoryprocessed"/>
			<transacted />
      <process ref="groupwiseProcessor" />
			<to uri="activemq:topic:blackboard"/>
    </route>
  </camelContext>

	<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
depends-on="matrixBrokerID">
		<property name="brokerURL" value="vm://matrixBroker?create=false"/>
	</bean>

	<bean id="jmsTransactionManager" class="org.springframework.jms.connection.JmsTransactionManager">
		<property name="connectionFactory" ref="jmsConnectionFactory"/>
	</bean>

	<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="connectionFactory" ref="jmsConnectionFactory"/>
		<property name="transacted" value="true"/>
		<property name="transactionManager" ref="jmsTransactionManager"/>
	</bean>

  <bean id="createDomainMessageProcessor" class="uk.ac.uhi.it.matrix.processing.domain.DomainGateway"
scope="prototype">
    <property name="mode" value="create"/>
  </bean>

  <bean id="groupwiseProcessor" class="uk.ac.uhi.it.matrix.processing.GroupwiseProcessor"
scope="prototype">
    <property name="csvDir" value="/tmp/test/out"/>
    <property name="holdingDir" value="/tmp/test/in"/>
  </bean>

</beans>




--------------
mov eax,1
mov ebx,0
int 80

On 5 Jul 2011, at 02:38, Willem Jiang wrote:

> On Mon Jul  4 20:38:48 2011, Alistair Young wrote:
>> found the prob - there was an activemq/camel instance already running. An error would
have been nice...
> 
> Can I have a quick look at your spring configuration?
> It could be helpful to find a way to warn the user if you can show us a small test case.
> 
> -- 
> Willem
> ----------------------------------
> FuseSource
> Web: http://www.fusesource.com
> Blog:    http://willemjiang.blogspot.com (English)
>        http://jnn.javaeye.com (Chinese)
> Twitter: willemjiang Weibo: willemjiang 


Mime
View raw message