I am attempting to, using Camel, receive AMQP messages from RabbitMQ and
pass them into a Drools Fusion engine. As my starting point I have a 4
line bit of Java code that instantiates Camel and passes it the camel XML
pasted below. Is it apparent to anyone where I've gone wrong that I
receive a NPE while the system is calling the init method for 'node1'?
<?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:rabbit="http://www.springframework.org/schema/rabbit"
xmlns:drools="http://drools.org/schema/drools-spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/rabbit
http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd
http://drools.org/schema/drools-spring
http://drools.org/schema/drools-spring.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="droolsPolicy"
class="org.drools.camel.component.DroolsPolicy"
/>
<drools:grid-node id="node1"/>
<drools:kbase id="kbase1" node="node1">
<drools:configuration>
<drools:mbeans enabled="true"/>
</drools:configuration>
<drools:resources>
<drools:resource type="DRL"
source="classpath:drools-rules.drl"/>
</drools:resources>
</drools:kbase>
<drools:ksession id="ksession1" type="stateful"
name="ksession1"
kbase="kbase1" node="node1"/>
<bean id="drools"
class="org.drools.camel.component.DroolsComponent"/>
<bean id="jsonMessageConverter"
class="amqp.spring.converter.XStreamConverter"/>
<bean id="textMessageConverter"
class="amqp.spring.converter.StringConverter"/>
<bean id="messageConverter"
class="amqp.spring.converter.ContentTypeConverterFactory">
<property name="converters">
<map>
<entry key="application/json"
value-ref="jsonMessageConverter"/>
<entry key="application/xml"
value-ref="textMessageConverter"/>
</map>
</property>
<property name="fallbackConverter"
ref="textMessageConverter"/>
</bean>
<rabbit:connection-factory id="connectionFactory"
host="127.0.0.1"
port="5672" />
<rabbit:template id="amqpTemplate"
connection-factory="connectionFactory"
message-converter="messageConverter"
reply-timeout="60000"/>
<rabbit:admin connection-factory="connectionFactory"/>
<camelContext
xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="stream:in?promptMessage=Enter something: "/>
<to uri="spring-amqp:cml.direct:a.b.c?type=direct"/>
</route>
<route>
<from uri="spring-amqp:cml.direct:springd:a.b.c?type=direct"
/>
<transform>
<simple>${body.toUpperCase()}</simple>
</transform>
<to uri="spring-amqp:cml.topic:a.b.c"/>
</route>
<route>
<from uri="spring-amqp:cml.topic:springt:#?type=topic" />
<to uri="stream:out"/>
</route>
</camelContext>
</beans>
I'm still extremely new to Drools, Camel, BRMS and my ultimate goal is to
have BRMS running, receiving events from RabbitMQ. This is one step along
my learning to achieve that goal so any help that can be offered is very
much appreciated.
It's potentially worth noting that the JAR files I'm running for this are
from the Drools-jBPM Integration 5.5 distribution.
Sincerely,
Jason