Re: [rules-users] Persistence in Drools 6

2014-05-22 Thread Charles Moulliard
Hi Jean Philippe,

I have recently created a project to persist bpmn process using Spring &
JPA / Hibernate. This config is working using kie-spring

https://github.com/cmoulliard/droolsjbpm-osgi-examples/blob/master/spring-jbpm-persistence/src/main/resources/META-INF/spring/context.xml

Regards,

Charles


On Thu, May 22, 2014 at 8:00 PM, Steinmetz, Jean-Philippe <
jpsteinm...@theworkshop.us.com> wrote:

> Hello All,
>
> I am trying to set up persistence for a standalone Drools (6.0.1.Final)
> application that uses JPA, Hibernate (4.3.5.Final) and Bitronix (2.1.4) via
> Spring (4.0.3.RELEASE).
>
> On the persistence side everything appears to be set up correctly. For my
> Drools session I use a KieContainer to create a new stateful session using
> an environment set up with the EntityManagerFactory and TransactionManager
> set. The problem that I am experiencing however is that nothing is getting
> persisted to the database. I have poured over the docs at least two dozen
> times and searched the net for anything related.
>
> Here is what my Spring context file looks like when creating the Drools
> session...
>
>  factory-method="newReleaseId">
> 
> 
> 
> 
>  factory-method="newKieContainer">
> 
> 
>  factory-method="newEnvironment">
> 
> 
> 
>  static-field="org.kie.api.runtime.EnvironmentName.ENTITY_MANAGER_FACTORY"/>
> 
> 
> 
>  static-field="org.kie.api.runtime.EnvironmentName.TRANSACTION_MANAGER"/>
> 
> 
> 
> 
> 
>  factory-method="newKieSession">
> 
>  
>
> Since the application is standalone I execute fireAllRules on the session
> at a regular interval (I use this instead of fireUntilHalt as it
> dramatically reduces the CPU load on the machine). With each call I wrap it
> in a transaction. Thus, the code looks as follows:
>
> while (!Thread.currentThread().isInterrupted()) {
> // Start a new transaction
> UserTransaction utx = utx = (UserTransaction)new
> InitialContext().lookup("java:comp/UserTransaction");
>utx.begin();
>
> // Tick the session
> kSession.fireAllRules();
>
> // Close the transaction
> utx.commit();
>
> // Sleep so that other applications can use the CPU
> try {
> Thread.sleep(1);
> } catch (InterruptedException e) {
> // When our sleep is interrupted it's because the executor
> wants us to shut down.
> Thread.currentThread().interrupt();
> }
> }
>
> When I inspect kSession in the debugger I can see the environment is
> properly set. I have tried digging down into the execute a bit but can't
> find any point at which the TransactionManager or EntityManagerFactory are
> used. As I said above I know Hibernate is set up correctly as well as
> Bitronix. I can see them working just fine in the logs and they definitely
> are hitting the database (and create tables for sessioninfo and
> workingmemory as they should). I just get nothing actually in the database
> stored, ever.
>
> Any help here is appreciated. It seems like it should work but it just
> doesn't.
>
> Thanks in advance,
>
> Jean-Philippe Steinmetz
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread Wolfgang Laun
1. The constraints are equivalent. $foo is bound to the Foo object, and
the getter does what the getter is supposed to do, and it's (probably)
visible - so why shouldn't it compile. Version 5.3 or maybe even 5.2 has
introduced general boolean expressions - are you using an older version?

I don't know what you mean by "being conditioned upon" - do you
understand the concept of "binding"?

2. Randomness should not matter.

3. Not seeing code that reproduces the issue, discussion is rather fruitless.

-W


On 22 May 2014 17:07, dec  wrote:
> Apologies,
> I had wanted to know:
> 1. Is it expected that this two rules would behave the same given the same
> input?
> Not sure I understand how would it even compile and how would the var be
> conditioned upon before  being assigned .
>
> 2. The input was just some random string.
>
> 3. The results are unexpected as we are getting a hit on this row even
> though the field is populated with some string. BUT what is suspicious is
> that it would seem we very rarely get this sort of behaviour. We also
> suspect if it has something to do with concurrency or multiple sessions
> concurrently executing.
>
> Most importantly, I would like to understand 1) - how is this even possible
> to come up with such a pattern and is it expected to behave like the
> intended rule
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647p4029654.html
> 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
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] OptaPlanner VRPTW Benchmark?

2014-05-22 Thread Paul Strohn
Might anyone on the list have come across  Gehring & Homberger VRPTW
benchmark
 
 
figures for Planner?  Given that record performance in the benchmark is 
something to brag about    in
some circles when pitching an optimizer to business customers, it would be
great to see how OptaPlanner stacks up!  



--
View this message in context: 
http://drools.46999.n3.nabble.com/OptaPlanner-VRPTW-Benchmark-tp4029663.html
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

Re: [rules-users] Using git-p4 with workbench

2014-05-22 Thread Mark Proctor
We use JGit and I don’t believe (but could be wrong) it has direct p4 support, 
like this git extension offers.
http://git-scm.com/docs/git-p4

However Git is distributed, so just clone and sync a p4 repo with this Git 
command line tool and use it as an intermediary. Then merge/mirror this 
intermediary with our JGit repo. 

Mark

On 22 May 2014, at 22:28, Steinmetz, Jean-Philippe 
 wrote:

> Hi,
> 
> Has anyone tried using a VCS bridge for git with the Drools 6 workbench? 
> Specifically I am interested in git-p4 so that I can access an existing maven 
> project that is currently stored in Perforce. Is this use case supported?
> 
> Thanks in advance,
> 
> Jean-Philippe
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Rule for "only one of the below exists", help please?

2014-05-22 Thread rogerL
Have a look at the collect command. Something like:

ArrayList( size == 1 ) from collect( LineItem (materialID == 'a' || == 'b' 
||  == 'c' ) )



--
View this message in context: 
http://drools.46999.n3.nabble.com/Rule-for-only-one-of-the-below-exists-help-please-tp4029658p4029660.html
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


[rules-users] Using git-p4 with workbench

2014-05-22 Thread Steinmetz, Jean-Philippe
Hi,

Has anyone tried using a VCS bridge for git with the Drools 6 workbench?
Specifically I am interested in git-p4 so that I can access an existing
maven project that is currently stored in Perforce. Is this use case
supported?

Thanks in advance,

Jean-Philippe
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

[rules-users] @propertyReactive not work when condition are coded in java

2014-05-22 Thread wtang

I have rule1 and rule2 and rule1 is modifying an object whose property is
checked in the when part of rule2 and rule2 should fire.

The problem is rule2 is not firing.  When I took out the @PropertyReactive
annotation, then rule2 will fire.

After further investigation, I find the cause is because in the when part I
am calling java function to do the comparison as suppose to using native
operators like "==".

Property Reactive seems to be not working when in the WHEN part of the rules
we are calling java function to do the comparison as suppose to using native
operators like ==, <, >, etc.  

Please advice.



--
View this message in context: 
http://drools.46999.n3.nabble.com/propertyReactive-not-work-when-condition-are-coded-in-java-tp4029657.html
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


[rules-users] Cannot issue fireUntilHalt when using persisted session

2014-05-22 Thread rogerL
Due to an issue with reloading persisted sessions that contained a cron timer
rule, I upgraded to 6.1.0.Beta3. Now I'm encountering a problem with a
threaded fireUntilHalt command (cannot be issued on a persisted session). 

Exception in thread "SimpleAsyncTaskExecutor-1"
java.lang.UnsupportedOperationException: Command session.fireUntilHalt();
cannot be issued on a persisted session
at
org.drools.persistence.SingleSessionCommandService$TransactionInterceptor.execute(SingleSessionCommandService.java:474)
at
org.drools.persistence.SingleSessionCommandService.execute(SingleSessionCommandService.java:353)
at
org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.fireUntilHalt(CommandBasedStatefulKnowledgeSession.java:272)...

It worked without issue in 6.0.1.Final. Though I suspect not, is this
expected behaviour? Alternately, are there configuration/other changes that
must be implemented.

Libs
spring 4.0.1
kie, drools, jbpm 6.1.0.Beta3
hibernate 4.3.4



 



--
View this message in context: 
http://drools.46999.n3.nabble.com/Cannot-issue-fireUntilHalt-when-using-persisted-session-tp4029656.html
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


[rules-users] Persistence in Drools 6

2014-05-22 Thread Steinmetz, Jean-Philippe
Hello All,

I am trying to set up persistence for a standalone Drools (6.0.1.Final)
application that uses JPA, Hibernate (4.3.5.Final) and Bitronix (2.1.4) via
Spring (4.0.3.RELEASE).

On the persistence side everything appears to be set up correctly. For my
Drools session I use a KieContainer to create a new stateful session using
an environment set up with the EntityManagerFactory and TransactionManager
set. The problem that I am experiencing however is that nothing is getting
persisted to the database. I have poured over the docs at least two dozen
times and searched the net for anything related.

Here is what my Spring context file looks like when creating the Drools
session...



























Since the application is standalone I execute fireAllRules on the session
at a regular interval (I use this instead of fireUntilHalt as it
dramatically reduces the CPU load on the machine). With each call I wrap it
in a transaction. Thus, the code looks as follows:

while (!Thread.currentThread().isInterrupted()) {
// Start a new transaction
UserTransaction utx = utx = (UserTransaction)new
InitialContext().lookup("java:comp/UserTransaction");
   utx.begin();

// Tick the session
kSession.fireAllRules();

// Close the transaction
utx.commit();

// Sleep so that other applications can use the CPU
try {
Thread.sleep(1);
} catch (InterruptedException e) {
// When our sleep is interrupted it's because the executor
wants us to shut down.
Thread.currentThread().interrupt();
}
}

When I inspect kSession in the debugger I can see the environment is
properly set. I have tried digging down into the execute a bit but can't
find any point at which the TransactionManager or EntityManagerFactory are
used. As I said above I know Hibernate is set up correctly as well as
Bitronix. I can see them working just fine in the logs and they definitely
are hitting the database (and create tables for sessioninfo and
workingmemory as they should). I just get nothing actually in the database
stored, ever.

Any help here is appreciated. It seems like it should work but it just
doesn't.

Thanks in advance,

Jean-Philippe Steinmetz
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread dec
Apologies,
I had wanted to know:
1. Is it expected that this two rules would behave the same given the same
input?
Not sure I understand how would it even compile and how would the var be
conditioned upon before  being assigned .

2. The input was just some random string.

3. The results are unexpected as we are getting a hit on this row even
though the field is populated with some string. BUT what is suspicious is
that it would seem we very rarely get this sort of behaviour. We also
suspect if it has something to do with concurrency or multiple sessions
concurrently executing.

Most importantly, I would like to understand 1) - how is this even possible
to come up with such a pattern and is it expected to behave like the
intended rule



--
View this message in context: 
http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647p4029654.html
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


Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread Wolfgang Laun
Please don't write any more posts like this.

You aren't asking a question, as far as I can see - so why do you post?

You write, darkly,  about suspicions of wrong or unexpected results
(which, to be sure, isn't the same thing). This is a big help.

-W


On 22/05/2014, dec  wrote:
> Due to a bug we came up with the following rule:
>
> /*
> Rule "intriguing"
> when
>$foo: Foo( $foo.getBar() == null )
> then
>...
> */
>
> Our original intention was to actually generate the rule like so:
>
> /*
> Rule "intended"
> when
>$foo: Foo( bar == null )
> then
>...
> */
>
> In most cases the "intriguing" rule actually seem to behave much like the
> "intended".
> We are unsure way.
> Moreover, we suspect that sometime we get wrong, or rather unexpected
> results when firing up this rule.
>
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647.html
> 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
>
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread Davide Sottara
Could you please elaborate on what you mean by "suspect that sometime we
get wrong, unexpected results"?
We'd need to know at least the inputs to reproduce the possible issue
Thanks
Davide


On 05/22/2014 05:35 AM, dec wrote:
> Due to a bug we came up with the following rule:
>
> /*
> Rule "intriguing"
> when
>$foo: Foo( $foo.getBar() == null )
> then
>...
> */
>
> Our original intention was to actually generate the rule like so:
>
> /*
> Rule "intended"
> when
>$foo: Foo( bar == null )
> then
>...
> */
>
> In most cases the "intriguing" rule actually seem to behave much like the
> "intended".
> We are unsure way.
> Moreover, we suspect that sometime we get wrong, or rather unexpected
> results when firing up this rule.
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647.html
> 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
>

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] London (May 26th) Drools & jBPM community contributor meeting

2014-05-22 Thread Mark Proctor
London, Chiswick, May 26th to May 30th

During next week a large percentage of the Drools team, some of the jBPM team 
and some community members will be meeting in London (Chiswick). There won’t be 
any presentations, we’ll just be in a room hacking, designing, exchanging ideas 
and planing. This is open to community members who wish to contribute towards 
Drools or jBPM, and want help with those contributions. This also includes 
people working on open source or academic projects that utilise Drools or jBPM. 
Email me if you want to attend, our locations may very (but within chiswick) 
each day. 

We will not be able to make the day time available to people looking for 
general Drools or jBPM guidance (unless you want to buy us all lunch). But we 
will be organising evenings things (like bowling) and could make wed or thu 
evening open to people wanting general chats and advice. Email me if you’re 
interested, and after discussing with the team, I’ll let you know.

Those currently attending:
Mark Proctor (mon-fri) Group architect
Edson Tirelli (mon-fri) Drools backend, and project lead
Mario Fusco (mon-fri) Drools backend
Davide Sottara (wed-fri) Drools backend
Alex Porcelli (mon-fri) Drools UI
Michael Anstis (thu-fri) Drools UI
Kris Verlaenen (wed-thu) jBPM backend, and project lead
Mauricio Salatino (mon-fri) jBPM tasks and general UI
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Suspicious behaviour when using a bound variable as a constraint in a pattern bound to the same var

2014-05-22 Thread dec
Due to a bug we came up with the following rule:

/*
Rule "intriguing"
when
   $foo: Foo( $foo.getBar() == null )
then
   ...
*/

Our original intention was to actually generate the rule like so:

/*
Rule "intended"
when
   $foo: Foo( bar == null )
then
   ...
*/

In most cases the "intriguing" rule actually seem to behave much like the
"intended".
We are unsure way.
Moreover, we suspect that sometime we get wrong, or rather unexpected
results when firing up this rule.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Suspicious-behaviour-when-using-a-bound-variable-as-a-constraint-in-a-pattern-bound-to-the-same-var-tp4029647.html
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