Need JSON request for Drools Server
by fulton
I have deployed Drools Server 5.1.1 on Tomcat and have successfully tested it
with the sample Test.jsp and with a raw XML <batch-execution> request via
TCPMON. However, I need to support JSON-based requests to the server, and I
have been unable to find any documentation or examples on how to specify a
valid JSON request to the server. Would someone please translate the sample
XML request to a JSON request that actually WORKS on the Drools Server.
<batch-execution lookup="ksession1">
<insert out-identifier="message">
<org.test.Message>
<text>Hello World</text>
</org.test.Message>
</insert>
</batch-execution>
BTW, I am behind a corporate proxy, so I cannot access certain web sites
(including plugtree.com!), but go ahead and point me to the "proper"
documentation for this, if any.
Thanks so much! Fulton
--
View this message in context: http://drools.46999.n3.nabble.com/Need-JSON-request-for-Drools-Server-tp2...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Problem in compiling each rule separately
by saurabh maheshwari
Hi sir ,
I have 10 rules . rules are created dynamically .Now if any of them is
causing problem so none of them runs
so I want to compile each rule separately , so that i can create knowledge
base with rules which have no errors
but can i do this ?
I am not finding the way how i can do it . is it possible ?
thanks ,
Saurabh Maheshwari
13 years, 8 months
[guvnor] How to use a rule in a java application
by Mario Viertel
Hi all,
I am new in Guvnor and have a lot of questions.
I have created a decision table with the Guvnor web app. I have also
created some test. All seems to be fine.
Now I want to use the rules in a web application. Unfortunately Guvnor
doesn't provide a web service interface so I must develop an own web
service to deal with the rules. But thats not so easy ...
In the Guvnor documentation I can see how to create KnowledgeBases and
builders and how to fire rules. But I cannot see how to receive rule
results.
Example:
The decision table looks similar like this:
rule 1 "under age"
if person.age < 18 then "under age"
rule 2 "pensioner female"
if person.age > 64 and person.gender == "female" then "pensioner"
rule 3 "pensioner male"
if person.age > 67 and person.gender == "male" then "pensioner"
rule 4 "full age"
* then "full age"
In my java application I create a person object:
Person p = new Person();
p.setBirthday(...);
p.setGender(...);
Now I miss a method in the Guvnor api to exectute the rules and receive
the result like this:
Person result = (Person) rules.execute(p);
Can somebody explain how to execute a rule and receive the result.
Thanks in Advance
Mario Viertel
Germany
13 years, 8 months
And Or Problem
by saurabh maheshwari
Hi sir ,
I am facing one issue regarding and( , ) and OR( || ) condition
i have one rule like that
dialect "java"
rule "mytest1"
when
test ( ( i==1,j==2) || (i == 2 ,j==3) )
then
System.out.println("Found");
end
it gives excpetion [ERR 102] Line 24:22 mismatched input ',' expecting
'then' in rule "mytest1"
can we not do such type of combination ?
dialect "java"
rule "mytest1"
when
test (( i==1 || j==2) ,(i == 2 || j==3))
then
System.out.println("Found");
end
this gives no excpetion and works as expected .
Regards ,
Saurabh Maheshwari
13 years, 8 months
Re: [rules-users] unable to create field extractor for tickerId
by FrankVhh
"Unable to create FIeld extractor", mostly that is because you did not
declare getters and in your java class.
Drools uses the getters to extract the needed values.
Make sure you use the correct naming conventions as well. I.e. public int
getTicketId(){...}
Regards,
frank
sirinath wrote:
>
> declare ReqMktData
> @role( event )
> end
>
> declare TickPrice
> @role( event )
> @expires( 2m )
> end
>
> declare TickSize
> @role( event )
> @expires( 2m )
> end
>
>
> rule "Bids"
>
> when
> $req: ReqMktData($tickerId : tickerId) from entry-point "IB Events"
> $bidprice: TickPrice(field == 1, tickerId == $tickerId, this after $req)
> from entry-point "IB Events"
> $bidsize: TickSize(field == 0, tickerId == $tickerId, this after $req)
> from entry-point "IB Events"
> then
> Bid bid = new Bid($tickerId, $req.contract, size, price);
> insert(bid);
> end
>
>
>
>
>
>
> public class ReqMktData {
> public int tickerId;
> public Contract contract;
> public String genericTickList;
> public boolean snapshot;
> }
>
--
View this message in context: http://drools.46999.n3.nabble.com/unable-to-create-field-extractor-for-ti...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
drools flow persistence doesn't work with spring jta - bug/TODO code in SingleSessionCommandService#initTransactionManager
by gs76pl
hi,
i've been trying to setup my drools flow persistence layer to use spring
transaction management (JTA) but it looks like some parts of the code are
missing in 5.1.1 rendering the whole idea impossible.
Whats happening is that when my transaction manager calls commit it gets
NullPointerException because jpm variable in SingleSessionCommandService has
never been set. It looks like it should be set in initTransactionManager
method in line 233 but all that this line is a comment that reads:
...else{
// configure spring for JPA and distributed transactions
}
So is there any way to have spring managing JTA transactions?
Sorry but it's been over a week for me trying to have drools persistence
working and after all the problems so far i'm considering jbpm5 as something
in a more "production ready state"
i've found similar thread here
http://drools.46999.n3.nabble.com/Drools-Spring-JPA-JTA-td2024942.html but
till now nobody replied to it with any explanation
below my spring config
<bean id="droolsFlowEntityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
p:dataSource-ref="droolsFlowDataSource"
p:persistenceUnitName="org.drools.persistence.jpa"
p:persistenceXmlLocation="classpath:/config/droolsflow/jpa/persistence.xml">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"
p:showSql="true" p:generateDdl="false" />
</property>
</bean>
<bean id="bitronixTransactionManagerConfig"
factory-method="getConfiguration"
class="bitronix.tm.TransactionManagerServices">
<property name="serverId" value="spring-btm" />
<property name="warnAboutZeroResourceTransaction" value="true"></property>
</bean>
<bean id="bitronixTransactionManager" factory-method="getTransactionManager"
class="bitronix.tm.TransactionManagerServices"
depends-on="bitronixTransactionManagerConfig" destroy-method="shutdown" />
<bean id="droolsFlowTransactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="bitronixTransactionManager" />
<property name="userTransaction" ref="bitronixTransactionManager" />
</bean>
--
View this message in context: http://drools.46999.n3.nabble.com/drools-flow-persistence-doesn-t-work-wi...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months
Strange intermittent problem with Drools Flow
by Dan Nathanson
Hi,
I'm seeing some odd behavior in some of my test cases. And it only
seems to happen to one guy. And he's done fresh checkouts of the code,
blown away his local M2 repository and verified installed software
like OS and Java is same as everyone else's.
I have some test cases that build up some simple flows programatically
using fluent API. Very simple (start --> work item --> work item -->
state --> end). I am using Drools Flow 5.1.1 with JPA (in-memory H2
DB for unit tests). Intermittently, after completing a work item, the
flow doesn't continue. Logging in a process event listener shows that
the the work item node is never left, although I can see in the logs
that the work item is deleted from DB.
There are no errors, warning or info level messages coming out of
Drools or Hibernate prior to the failure.
It only happens to one guy, but he can reproduce the problem
regularly, although it moves around in different test cases and
different points in the flows.
Anyone ever seen this behavior before? Any possible explanations?
I'd attach the log file, but it is huge since I've got hibernate
logging set very verbose.
Regards,
Dan Nathanson
13 years, 8 months
First Order Logic - METHODS in Drools
by Arjun Dhar
According to First order Logic, (from a rule perspective), one can represent
their statements using:
PREDICATES, METHODS, CONNECTORS (including existential quantifiers)
..while PREDICATES can be synonymous with Object and Object expressions; the
only way of using methods has been via "eval" (AFAIK, as per my outdated
knowledge); and this is discouraged for the fact that evals perhaps dont fit
in the RETE-OO scheme of things.
Please note: By methods I dont bean Bean getter/setters; but work horse
service layer methods.
..however, to be true to FOL, using methods directly should be supported.
Q1) If it is, can one show or state an example?
Q2) If not, for METHODS that return a specific type of Object, cant they be
useful in RETE-OO evaluation?
Q3) I've used "from" for DAO's , conceptually does "from" address this
fully? In FOL (imo) PREDICATES & METHODS can be exchanged freely, not sure
if "from" gives that freedom.
thanks
--
View this message in context: http://drools.46999.n3.nabble.com/First-Order-Logic-METHODS-in-Drools-tp2...
Sent from the Drools: User forum mailing list archive at Nabble.com.
13 years, 8 months