camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmoulliard <cmoulli...@gmail.com>
Subject Re: Can Camel read an uri like this "activemq:topic:stock.*" ?
Date Mon, 03 Nov 2008 16:19:38 GMT

This is strange because the following routing does not work

<?xml version="1.0" encoding="UTF-8"?>
<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-2.5.xsd
       http://www.springframework.org/schema/context 
       http://www.springframework.org/schema/context/spring-context-2.5.xsd
       http://activemq.apache.org/camel/schema/spring 
       http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

	<!-- ActiveMQ brokerURL using VM protocol -->
	<bean id="jms"
class="org.apache.activemq.camel.component.ActiveMQComponent">
		<property name="brokerURL"
		          value="vm://localhost:61616?broker.persistent=true" />
    </bean>

	<!-- This config does not work
	<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
		<property name="connectionFactory">
			<bean class="org.apache.activemq.ActiveMQConnectionFactory">
				<property name="brokerURL"
value="vm://localhost:61616?broker.persistent=false" />
			</bean>
		</property>
	</bean>
	 -->

	<bean id="camelTracer"
class="org.apache.camel.processor.interceptor.Tracer">
		<property name="traceExceptions" value="false" />
		<property name="traceInterceptors" value="true" />
		<property name="logLevel" value="DEBUG" />
		<property name="logName" value="com.xpectis.tracker" />
	</bean>

	<bean id="traceFormatter"
class="org.apache.camel.processor.interceptor.TraceFormatter">
		<property name="showBody" value="true" />
		<property name="showHeaders" value="true" />
		<property name="showBodyType" value="false" />
		<property name="showBreadCrumb" value="false" />
	</bean>

	<!-- Based on Formatter class but no more required since 1.5 
	<bean id="myXstreamDataFormat" class="com.xpectis.model.Formatter"
		factory-method="createInstance">
		<constructor-arg value="com.xpectis.model.StockPrice" />
	</bean>
	 -->
	 <bean id="myXstreamDataFormat"
class="org.apache.camel.dataformat.xstream.XStreamDataFormat"
	      factory-method="processAnnotations">
		<constructor-arg value="com.xpectis.model.StockPrice" />
	</bean>
	 
	<bean id="stockPriceGenerator"
class="com.xpectis.service.common.impl.StockPriceGenerator" />
	<bean id="stockUpdater"
class="com.xpectis.service.common.impl.StockUpdater" />

	<camelContext id="camel" trace="true"
		xmlns="http://activemq.apache.org/camel/schema/spring">
		<!--  <jmxAgent id="agent" createConnector="true" /> --> 
		<route>
			<from
uri="timer:generateStockPrice?fixedRate=true&amp;delay=10000&amp;period=5000"
/>
			<to uri="bean:stockPriceGenerator" />
			<marshal ref="myXstreamDataFormat" />
			<splitter>
				<xpath>//price</xpath>
				<setHeader headerName="stock">
					<xpath>//price/@stock</xpath>
				</setHeader>
				<recipientList>
					<simple>jms:topic://STOCK.${in.header.stock}</simple>
				</recipientList>
			</splitter>
			</route>
                        <!-- everything works fine till here -->

			<route>
			<from uri="jms:topic://STOCK.*" />
			<unmarshal ref="myXstreamDataFormat" />
			<to uri="bean:stockUpdater" />
                        <!-- nothing arrives at my bean -->
			</route>
	
	</camelContext>

</beans>



James.Strachan wrote:
> 
> 2008/11/3 cmoulliard <cmoulliard@gmail.com>:
>>
>> Hi,
>>
>> I would like to know if Camel can read an uri like this (from
>> uri="activemq:topic:stock.*") where the star represents any topic created
>> with the root name STOCK. ?
> 
> Yes
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 


-----
Enterprise Architect

Xpectis
12, route d'Esch
L-1470 Luxembourg

Phone +352 25 10 70 470
Mobile +352 621 45 36 22

e-mail : cmoulliard@xpectis.com
web site :  www.xpectis.com www.xpectis.com 
My Blog :  http://cmoulliard.blogspot.com/ http://cmoulliard.blogspot.com/  
-- 
View this message in context: http://www.nabble.com/Can-Camel-read-an-uri-like-this-%22activemq%3Atopic%3Astock.*%22----tp20305361s22882p20305700.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message