我是camel和活动mq的新手。我正在使用jboss-fuse,我已经在fuse控制台中创建了一个队列,并且我已经在jbossdeveloperstudio中用osgi制作了一个驼色蓝图。在蓝图中,我有slite csv记录,并将记录的一个接一个地发送到队列。但我得到connectionFactory必须指定错误。有人能治好我吗???
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
xmlns:amq="http://activemq.apache.org/schema/core"
xmlns:blueprint="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean id="transactionManager"
class=
"org.springframework.jms.connection.JmsTransactionManager">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
</bean>
<bean id="jmsConnectionFactory" class=
"org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value=
"tcp://IYC6ITDT1:61616?maximumConnections=1000"/>
</bean>
<bean class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="transacted" value="true"/>
</bean>
<camelContext trace="false" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="file:C:/Users/thomasalbert/workspace/uyirnokkam/input"/>
<unmarshal>
<beanio mapping="isha/mdm/uyn/participant-datamapping.xml" streamName="participantFile"/>
</unmarshal>
<split>
<simple>${body}</simple>
<marshal>
<json library="Jackson"/>
</marshal>
<convertBodyTo type="java.lang.String"/>
<log message="This is the JSON record: ${body}"/>
<to uri="jms:queue:Thomas"/>
</split>
</route>
</camelContext>
</blueprint>
由于jmsComponent bean id没有定义,请将id指定为"jms",如下所示
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsConnectionFactory"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="transacted" value="true"/>
</bean>
此外,此id用于访问下面一行中的队列
<to uri="jms:queue:Thomas"/>
因此,如果bean id是"sampleJMS",那么端点将更改为"sampleJMS:queue:Thomas"
这应该可以解决当前的错误,但代码中还有一些错误。
示例:maximumConnections不能作为brokerUrl中的参数传递,而是使用PooledConnectionFactory将其作为参数传递,如中所述http://camel.apache.org/activemq.html#ActiveMQ-使用连接池