[rules-users] JRuby Objects as Drools Facts

Ray Hooker ray.hooker at gmail.com
Tue Dec 3 14:17:40 EST 2013


I have seen where one group in India claimed to be able to inserts JRuby
objects as facts to Drools.  I am very open to suggestions.  The JRuby
objects appear to Java to be class RubyObject.  When I insert say a JRuby
class named "Message", here is the message:

[ObjectInsertedEventImpl: getFactHandle()=[fact
0:1:341074620:341074620:1:DEFAULT:NON_TRAIT:#<Message:0x145462bc>],
getObject()=#<Message:0x145462bc>,
getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl at 4cb91eff,
getPropagationContext()=PhreakPropagationContext
[entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:1:341074620:341074620:1:DEFAULT:NON_TRAIT:#<Message:0x145462bc>],
leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]]

On the other hand if I insert a Java class in the same way, it is seen as:

==>[ObjectInsertedEventImpl: getFactHandle()=[fact
0:1:1319007734:1319007734:1:DEFAULT:NON_TRAIT:com.antelopesoftware.drools.Message at 4e9e75f6],
getObject()=com.antelopesoftware.drools.Message at 4e9e75f6,
getKnowledgeRuntime()=org.drools.core.impl.StatefulKnowledgeSessionImpl at 139ba1d8,
getPropagationContext()=PhreakPropagationContext
[entryPoint=EntryPoint::DEFAULT, factHandle=[fact
0:1:1319007734:1319007734:1:DEFAULT:NON_TRAIT:com.antelopesoftware.drools.Message at 4e9e75f6],
leftTuple=null, originOffset=-1, propagationNumber=2, rule=null, type=0]]

So how can I get the Drools engine to recognize the fact.  BTW my real
application is read from a MongoDB database using Mongoid and insert the
data into Drools.  I wrote wrapper Java classes to make it easier.

Thanks in advance,

Ray




--
View this message in context: http://drools.46999.n3.nabble.com/JRuby-Objects-as-Drools-Facts-tp4027079.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list