Re: [rules-users] MySQL / Postgres With Human Task Process Sample
by Al ITF
Did anyone resolve this?
I've stumbled across the same issue trying to get "org.drools.task" working
with MS SqlServer.
Mauricio Salatino wrote:
>
> Take it easy man... I have here Drools Flow running with PostgreSQL I will
> try to package the project and then publish it in my blog.. I will send
> you
> the link when it's ready..
>
> 2009/7/24 JunckyUser <rafiuddin.mk(a)gmail.com>
>
>> I Don't think Drools Flow is used by this user-list group. I am searching
>> at wrong place. Can any one help me in getting a "link or sample on MySQL
>> or
>> Postgress with Human Task process"............
>>
>> JunckyUser wrote:
>> Hi, New to Drools, can any one provide a link or sample
>> on...<http://www.nabble.com/user/SendEmail.jtp?type=post&post=24639830&i=0>MySQL
>> Human Task process. Cristiano Gavião have you able to solve your
>> issues mentioned in this thread. Thanks in Advance...
>>
>> Cristiano Gavião wrote:
>> Hi, I was trying to change the persistence settings for human task
>> process
>> server for using MySQL instead of H2DB. I was following the Drools Flows
>> Documentation on chapter 5.1.3.: Configuring Persistence.(
>> https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/t...)
>> I read on docs that I should override the persistence.xml of the
>> drools-process-enterprise.jar, create the drools.session.conf with some
>> contents (i don`t undestand` what it is...) and put them on my project
>> META-INF directory... ok? I created the files as stated on docs but it
>> didn't work... My example runned ok, but using the H2DB and not my MYSQL.
>> //
>> Use persistence.xml configuration emf =
>> Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
>> taskService = new TaskService(emf); taskSession =
>> taskService.createSession(); server = new MinaTaskServer(taskService);
>> Thread thread = new Thread(server); thread.start(); Thread.sleep(500);
>> System.out.println("Server started ..."); After some investigation I
>> could
>> see that the example recommended by Mark Proctor (TaskLifeCycleTest.java,
>> and others that use MinaTaskServer) use that is setting on
>> drools-process-task.jar and not the "org.drools.persistence.jpa" on
>> drools-process-enterprise.jar as stated on documentation... First
>> question,
>> which one should I use for use the Drools Flows Server and Client? emf =
>> Persistence.createEntityManagerFactory( "org.drools.task" ); emf =
>> Persistence.createEntityManagerFactory("org.drools.persistence.jpa"); I
>> test
>> the first option. I changed the persistence.xml file and use the code
>> below:
>> // Use persistence.xml configuration emf =
>> Persistence.createEntityManagerFactory("org.drools.task"); taskService =
>> new
>> TaskService(emf); taskSession = taskService.createSession(); server = new
>> MinaTaskServer(taskService); Thread thread = new Thread(server);
>> thread.start(); Thread.sleep(500); System.out.println("Server started
>> ...");
>> Hummm.... It runs and connect well to my MySQL. but now it brings me a
>> error... java.lang.IllegalArgumentException: Named query not found:
>> UnescalatedDeadlines at org .hibernate .ejb .AbstractEntityManagerImpl
>> .createNamedQuery(AbstractEntityManagerImpl.java:108) at
>> org.drools.task.service.TaskService.(TaskService.java:84) at
>> org.drools.task.service.TaskService.(TaskService.java:68) It sounds like
>> it
>> was not possible to find orm.xml that is on META-INF of
>> drools-process-task.jar. But when I copy the orm.xml file to my project
>> META-INF it works ok.... Could someone give some ideas how can I solve
>> this
>> problem.. Thanks a lot Cristiano
>> _______________________________________________ rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------
>> View this message in context: MySQL / Postgres With Human Task Process
>> Sample<http://www.nabble.com/Problems-setting-MySQL-for-the-human-task-process-s...>
>> Sent from the drools - user mailing list
>> archive<http://www.nabble.com/drools---user-f11823.html>at Nabble.com.
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
>
> --
> - http://salaboy.wordpress.com
> - http://www.jbug.com.ar
> - Salatino "Salaboy" Mauricio -
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
View this message in context: http://www.nabble.com/Problems-setting-MySQL-for-the-human-task-process-s...
Sent from the drools - user mailing list archive at Nabble.com.
15 years, 3 months
Queries vs Rules with same LHS
by Dave McLoughlin
I'm looking for more information on how queries are handled/processed in
the Drools rule engine v. 4.0.7? I am specifically interested on a
computational cost of a query compared to a rule with the same LHS. As I
understand a rule will match on any single fact that fulfills LHS. On
the other hand a query will provide all facts that fulfill its LHS. How
much more does this cost?
Is there a best practice doc or article on this type of information?
Dave
15 years, 3 months
KnowledgeAgent Log Level
by Andrew Waterman
Hi,
I'm wondering if there is a way to manipulate the log level for the
KnowledgeAgent. Currently, I'm getting dumps to the console that I'd
like to control:
> [2009:09:253 17:09:371:info] KnowledgAgent applying ChangeSet
> [2009:09:253 17:09:371:debug] KnowledgeAgent subscribing to
> resource=[ClassPathResource path='mx/ecosur/multigame/impl/
> manantiales.drl']
> [2009:09:253 17:09:371:debug] ResourceChangeNotification subscribing
> listener=org.drools.agent.impl.KnowledgeAgentImpl@3ebfd8 to
> resource=[ClassPathResource path='mx/ecosur/multigame/impl/
> manantiales.drl']
> [2009:09:253 17:09:372:debug] KnowledgeAgent ChangeSet requires
> KnowledgeBuilder
> [2009:09:253 17:09:372:debug] KnowledgeAgent rebuilding
> KnowledgeBase using ChangeSet
> [2009:09:253 17:09:373:debug] KnowledgeAgent building
> resource=[ClassPathResource path='mx/ecosur/multigame/impl/
> manantiales.drl']
> [2009:09:253 17:09:420:info] KnowledgeAgent new KnowledgeBase now
> built and in use
Thanks!
best wishes,
Andrew
---------------------------------
Andrew Waterman
San Cristóbal de las Casas, Chiapas, Mexico
15 years, 3 months
Unable to map process variables into WorkItem.
by Stuart Grimshaw
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm trying to access the fact object from within my WorkItemHandler, but
I'm struggling.
See http://pastie.org/613312 for the various bits of code, but my
problem is that when I set a breakpoint in the WorkItemHandler and call
workItem.getParameters(), the result is empty.
I think I'm creating the Map correctly and inserting it into the process
scope, but maybe someone can spot what I'm doing wrong?
- --
+
| Stuart Grimshaw Broadband Solutions for
| Lead Developer Home & Business @
| Plusnet Plc www.plus.net
| Registered Office: Internet House, 2 Tenter Street, Sheffield, S1 4BY
| Registered in England no: 3279013
+ --------------- Plusnet - ISPA Best Consumer ISP 2008 ---------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkqqJ1YACgkQKVVpabZzO7mqlACfQp9MinLoBCH6b5o4cShcZI/T
/tQAniNgBnWVMw/2Ka7w1jJvwYZtMLVi
=5RJV
-----END PGP SIGNATURE-----
15 years, 3 months
Drools and Eclipse 3.5
by J Michael Dean
Sorry because I am sure this has been answered, but cannot find.
Compelling reasons to switch to Eclipse 3.5 because of recent changes
to Mac OSX but documentation pretty clearly indicates 3.4 for Drools
5.0. Is Drools 5.0 compatible with Eclipse 3.5?
- Mike
15 years, 3 months
Problem with JPA session persistence in Drools Flow (5.0.1)
by Alan.Gairey@tessella.com
I'm currently using Drools Flow with JPA session persistence enabled as
described in section 5.1 of the User Guide.
As a process executes, session information is saved to the H2 database
correctly.
The problem comes if a process only executes part way through, and I then
try to finish the process by recreating a session using the code:
// recreate the session from database using the sessionId
ksession = JPAKnowledgeService.loadStatefulKnowledgeSession( sessionId,
kbase, null, env );
This gives me a NullPointerException.
Having looked into the Drools Flow source code, I think the problem is in
the class
drools-persistence-jpa\src\main\java\org\drools\persistence\session\SingleSessionCommandService.java.
The 4th constructor of this class is called as part of the loading of a
knowledge session from the H2 database; this in turn leads to the
afterCompletion method of the inner class SynchronizationImpl being
called. The final two lines of this method are:
((JPAProcessInstanceManager) ((ReteooWorkingMemory)
session).getProcessInstanceManager()).clearProcessInstances();
((JPAWorkItemManager) ((ReteooWorkingMemory)
session).getWorkItemManager()).clearWorkItems();
However, when called via the route described above, the session member
variable of SingleSessionCommandService has not been set, thus causing the
NullPointerException.
(Interestingly, running the unit tests for drools-persistence-jpa does
result in the NullPointerException being thrown multiple times, although
the tests are still listed as having passed.)
I believe enclosing the above two lines as follows will fix the problem:
if (session != null) {
((JPAProcessInstanceManager) ((ReteooWorkingMemory)
session).getProcessInstanceManager()).clearProcessInstances();
((JPAWorkItemManager) ((ReteooWorkingMemory)
session).getWorkItemManager()).clearWorkItems();
}
Also, in the 4th constructor of SingleSessionCommandService, after the
session has been set, the following line needs to be added to ensure the
session id is the same as the session info id:
((ReteooStatefulSession) this.session).setId( this.sessionInfo.getId() );
(This line is present at the end of the 3rd constructor.)
It would be great if this fix could make it into the Drools 5.1 release.
Thanks.
15 years, 3 months
Getting the return from a funcion
by Leandro Carvalho
Hi! I'm new here and a have a doubt about rules and functions in Drools.
I have this rule:
rule "ProductDescription validation"
when
$listing : Listing( $description:productDescription != null )
eval( $description.getTitle() != null )
eval( hasForbiddenWordsSet( wordsSet, $description.getTitle() ) )
then
System.out.println("ERROR!");
end
And this function:
function boolean hasForbiddenWordsSet(Set wordsSet, String value) {
#do something useful here
}
And everything works fine. But now I want that function
"hasForbiddenWordsSet" return a String. For example to print at "then".
I tried something like this:
rule "ProductDescription validation"
when
$listing : Listing( $description:productDescription != null )
eval( $description.getTitle() != null )
$word : hasForbiddenWordsSet( wordsSet, $description.getTitle() )
then
System.out.println("ERROR: " + word);
end
function String hasForbiddenWordsSet(Set wordsSet, String value) {
#do something useful here
}
But it doesn't work, tried some other things and still no success.
Could someone help me?
Thanks in advance.
--
Leandro Carvalho
15 years, 3 months
Using Drools for modeling with rule-driven agents
by Russ Abbott
Hi,
I'm interested in developing (if it doesn't already exist) and then using a
framework for agent-based modeling in which the agents are rule driven. An
important feature is that the agents and their rules must be dyanically
manipulable. That is, both the agents and the rules must be first class
objects that can be manipulated as the system is running. Can Drools support
that?
As someone not familiar with Drools I did my best to find out by looking at
the Drools Expert User's
Manual<http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/tr...>.
>From what I could tell, the Template
feature<http://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/tr...>in
which one uses Java objects as Template data sources comes close. I'd
like your advice before putting too much development effort into attempting
to use it for that purpose.
In particular, would it be possible to set up a mechanism that could: create
and delete agents on the fly; associate rule sets with agents on the fly;
and modify the rules associated with an agent on the fly? After each such
action the system would change to reflect the change in agents and rules.
Thanks for your help.
-- Russ Abbott
P.S. If Drools would not be a good choice, is there some other system that
you could recommend?
15 years, 3 months
Re: [rules-users] (no subject)
by Garner, Shawn
Functions on the LHS are not advised and says so in the drools user guide.
I can think of two ways to do this (forgive me if my syntax is slightly off).
Way number 1
rule "ProductDescription validation"
when
$listing : Listing( $description:productDescription != null, description.title != null )
then
ListingScrubber listingScrubber = new ListingScrubber(listing);
insert(listingScrubber);
end
rule "ProductDescription validation Part 2"
when
$listingScrubber : ListingScrubber(forbiddenWordInTitle == true , $title: productDescription.title)
then
String word = $listingScrubber.getWord();
System.out.println("ERROR: " + word);
end
Way number2
rule "ProductDescription validation"
when
$listing : Listing( $description:productDescription != null, $title : productDescription.title != null)
then
List<ListingWord> listingWordList = listing.getListingWords();
Iterator<ListingWord> listingWordListIter = listingWordList.iterator();
while(listingWordListIter.hasNext())
{
ListingWord listingWord = listingWordListIter.next();
assert(listingWord);
}
end
$word : hasForbiddenWordsSet( wordsSet, $description.getTitle() )
rule "ProductDescription validation Part 2"
when
$badWordList : BadWordList($wordList : list)
$listingWord : ListingWord($word : word memberof $wordList, $listing : listing)
then
System.out.println($listing.productDescription + " has naughty word:" + $word);
End
>>> Original Message>>
Hi! I'm new here and a have a doubt about rules and functions in Drools.
I have this rule:
rule "ProductDescription validation"
when
$listing : Listing( $description:productDescription != null )
eval( $description.getTitle() != null )
eval( hasForbiddenWordsSet( wordsSet, $description.getTitle() ) )
then
System.out.println("ERROR!");
end
And this function:
function boolean hasForbiddenWordsSet(Set wordsSet, String value) { #do something useful here }
And everything works fine. But now I want that function "hasForbiddenWordsSet" return a String. For example to print at "then".
I tried something like this:
rule "ProductDescription validation"
when
$listing : Listing( $description:productDescription != null )
eval( $description.getTitle() != null )
$word : hasForbiddenWordsSet( wordsSet, $description.getTitle() )
then
System.out.println("ERROR: " + word); end
function String hasForbiddenWordsSet(Set wordsSet, String value) { #do something useful here }
But it doesn't work, tried some other things and still no success.
Could someone help me?
Thanks in advance.
--
Leandro Carvalho
15 years, 3 months