2014-08-28 63 views
1

我是新来的骆驼和活跃mq。我使用jboss保险丝,并且我已经在保险丝控制台中创建了一个队列,并且我在jboss developer studio中用osgi制作了骆驼蓝图。在蓝图中,我有sls 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> 

回答

0

对于jmsComponent豆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:队列:托马斯”

这应该可以解决当前的错误,但是在你的代码中再次出现一些错误。

实施例:maximumConnections不能作为brokerUrl参数传递,而是使用其与PooledConnectionFactory作为参数传递如http://camel.apache.org/activemq.html#ActiveMQ-Usingconnectionpooling

解释