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.
Using that, you can have a well-defined fact model, and convert your Redis HashMap to it with minimal code.
Steve
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.
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