You could just create a Java POJO fact, containing a hashmap, and set that hashmap to be a reference to your Redis hash map. It ought to work as long as you don't intend to have any rules which depend on reacting to changes to values within the hashmap.

However, without a properly defined fact model, it's somewhat questionable whether you're going to get any real benefit from using Drools in the first place.

If you're just trying to avoid writing code for doing the marshalling, then I would recommend checking out Apache Commons BeanUtils. There is a populate() method which will copy values from a Map to a bean.

http://commons.apache.org/proper/commons-beanutils//api/org/apache/commons/beanutils/BeanUtils.html#populate(java.lang.Object, java.util.Map)

Using that, you can have a well-defined fact model, and convert your Redis HashMap to it with minimal code.

Steve



On 4 Jun 2013, at 03:42, pprasad <pradeep_prasad@hotmail.com> wrote:

Thanks for your prompt reply. I am working on a fraud system for a bank and they have around 3 millions records.

All my data is loaded to redis and I can access the key using jedis. How do I insert redis hashmap to fact in one go. I do not want to iterate for every key and insert fact individually.

Is there a way to get the instance of redis hashmap in java and insert that hashmap as a fact.

 
Thanks and Regards
Pradeep Prasad



Date: Sun, 2 Jun 2013 22:08:32 -0700
From: [hidden email]
To: [hidden email]
Subject: Re: [rules-users] StatefulKnowledgeSession and multi-threaded processing

You can do it as per my knowledge. Only thing is you will access in drl from java code. I dont think it will be an issue. but what the reason for sending hashmap as fact, You should have a different way of sending facts. As per my observation no rule needs so much of data to make a decision. It should have name value parameters to make the decision. 

Hope this helps.

thanks
kamal.


On Sun, Jun 2, 2013 at 9:59 PM, pprasad [via Drools] <[hidden email]> wrote:
Hi,

Is it possible to insert redis hashmap as it is as fact into rule engine. I am using Jedis from java to access jedis and drool rule engine.
Also, Is there a way to access redis hashmap from drl file.

Thanks,
Pradeep


If you reply to this email, your message will be added to the discussion below:
http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-and-multi-threaded-processing-tp3599689p4024075.html
To unsubscribe from StatefulKnowledgeSession and multi-threaded processing, click here.
NAML




If you reply to this email, your message will be added to the discussion below:
http://drools.46999.n3.nabble.com/StatefulKnowledgeSession-and-multi-threaded-processing-tp3599689p4024076.html
To unsubscribe from StatefulKnowledgeSession and multi-threaded processing, click here.
NAML


View this message in context: RE: [rules-users] StatefulKnowledgeSession and multi-threaded processing
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users