Grid Node Null Pointer Exception
by Jason Barto
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
12 years, 7 months
How to write Hibernate query lang(HQL) in .DRL file
by zeeshan
Hi !
According to my requirement I need to fetch and Insert data from database
using Hibernate Query from .DRL file.
I have idea how to execute HQL in Plain Java class but according to my
requirement,I need to fire query to database from .DRL file which I tried
but unable to get output instead I was getting errors.
Can anyone suggest me process to execute Hibernate Query from DRL file
or please provide me some sample code or any link.
Thanks !!
--
View this message in context: http://drools.46999.n3.nabble.com/How-to-write-Hibernate-query-lang-HQL-i...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Performing Hibernate NativeSQLQuery in Drools
by Roopa
Hi,
I need some inputs on integrating Hibernate with Drools platform.
Please do help me executing nativeSQLQuery of Hibernate in Drools DRL file
In Java file, setting the session as global parameter in Drools
droolsSession.setGlobal("hibernateSession", session);
and in the DRL file, in when clause I am trying to execute the Native SQL
Query
Order() from hibernateSession.createSQLQuery("SELECT id FROM
Order").list(); // this query will give the list of orderId s from RDBMS.
Here, Order() is a POJO class (Entity) mapping to Order table.
When executed, I found the Order() entity is not populated with the id
values from the query.
Can some one help me with the tutorial which speaks about Quering DB via
Hibernate NativeSQL Query in Drools.
--
View this message in context: http://drools.46999.n3.nabble.com/Performing-Hibernate-NativeSQLQuery-in-...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
new Kie API and RuleMatrixSheetListener()
by Ramon Buckland
Hi,
I am looking at the new Kie API and I am trying to work out how I tell it / Drools that I have a RuleMatrixSheet ..
https://github.com/droolsjbpm/drools/blob/master/drools-decisiontables/sr...
This was the old way (a bit manual)
final SpreadsheetCompiler converter = new SpreadsheetCompiler();
final InputStream stream = this.getClass().getResourceAsStream( "/path/to/spreadsheet.xls" );
final String drl = converter.compile( stream,
InputType.XLS,
new RuleMatrixSheetListener() );
Is there an example of a matrix style Spreadsheet being used to generate the rules, with the new Kie APIs ?
I can't seem to find similar concepts on the ResourceFactory API, or on "Resource"
Version 5 and version 6 don't really "support" the Configuration object understanding the Matrix Style Rules table.
If it were to be implemented, it looks like :
org.kie.api.builder.KieFileSystem
needs some changes, to support the compilation of a Rule Matrix where write* is taking a Resource,
If there is not an Example, what do I need to "wire" together for this.
Any pointers are much appreciated.
Kind regards
Ramon
Ramon Buckland
ramon(a)thebuckland.com
12 years, 7 months
Using XMLGregorianCalendar for @timestamp metadata
by ScalaEnthusiast
I have an object that comes into a stream as an event and I want to use
@timestamp to specify the event time from the object.
Then field that has this information is an XMLGregorianCalendar called
timeStamp. If I specify this attribute with @timestamp(timeStamp) I get and
error saying that conversion to long from the XMLGregorianCalendarImpl is
not supported. Ok, I get that.
now, I can get a java Date by calling the following method chain on the
timeStamp object:
timeStamp.toGregorianCalendar().getCalendarDate()
specifying this in the @timestamp does not validate, presumably because
@timestamp is looking for an attribute (or chain of attributes) and not a
chain of method calls.
Is there anyway to specify a timestamp in the rule using an
XMLGregorianCalendar?
--
View this message in context: http://drools.46999.n3.nabble.com/Using-XMLGregorianCalendar-for-timestam...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Drools Accumulate function
by lyally
Hi,
I am new to Drools so please excuse me if this is a simple question.
I currently have several rules that look as follows (one for each entry
point):
The intention of these rules is to average the speed, occupancy and flow of
traffic at a particular road location over a 30 second sliding window. The
rule works fine as it is, however it is not very scalable since I currently
need a similiar rule and associated input stream for each road location that
I am monitoring. There may be 100s of these.
What I was really after was one rule that would perform the same averaging
calculations over the 30 second window. My first thoughts were that I would
need to lose the individuall input streams per location and thereby place
all of the TrafficData facts from all locations into working memory. But
then I was unsure how I would change the rule to group relevant TrafficData
instances by their location (Note that the TrafficData instance has a
location identifier within it) together before doing the averaging.
Any assistance would be much appreciated.
Regards,
Steve
--
View this message in context: http://drools.46999.n3.nabble.com/Drools-Accumulate-function-tp4023718.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Restricting the items included in a snapshot
by Lance Leverich
I am aware of how Guvnor can be told to only include assets with a given
state, during the build process. What I haven't been able to figure out is
a way to tell Guvnor to only include the items that were part of the latest
build, when creating a snapshot. Is there a way to do this? I am using
Guvnor 5.3.5.Final.
~ Lance
12 years, 7 months