OptionalDataException on reading packages..
by mechlife
I have the application setup where the drl is generated from the database and
then written to the file system. So far i have been working with the drl's
without any problems but have run into issues while working with packages.
Any help is much appreciated. Thanks.
Here is what i am doing while serializing the package.
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader(drl));
Package pkg = builder.getPackage();
DroolsStreamUtils.streamOut(new ObjectOutputStream(new FileOutputStream(new
File(fileName+".pkg"))), pkg);
i also tried the writeExternal on package, this genereate the file but got a
class cast exception while trying to load it.
The pkg file is generated and i dont think it has a problem unless i am
missing something in the above code.
Now, on the other side i am using drools-spring which sets up the agent on
startup. I was doing some trial and error and found two configurations that
worked but needed
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
to be in code, just the spring configuration didnt work (again if i am
missing something please let me know).
here are the spring configuration
First
<drools:kagent id="agent" kbase="base" new-instance="true"/>
<drools:kbase id="base">
<drools:resources>
<!--drools:resource type="DRL" source="file:C:\file.drl"/--> //this works
<drools:resource type="PKG" source="file:C:\file.pkg"/>
</drools:resources>
</drools:kbase-->
Second
<drools:kagent id="agent" kbase="base" new-instance="true">
<drools:resources>
<drools:resource type="CHANGE_SET" source="file:C:\change-set.xml"/>
</drools:resources>
</drools:kagent>
<drools:kbase id="base"></drools:kbase>
and the changeset
<change-set...>
<add>
<resource source='file:/C:/file.pkg' type='PKG'/>
</add>
</change-set>
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/OptionalDataException...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 6 months
Hibernate + Bitronix + Tomcat working configuration
by Gustavo Tenrreiro
Hi,
Does anyone have a working Hibernate + Bitronix + Tomcat configuration
which works with Drools process persistence ?
If so can you share it?
In my case Hibernate just does not find the Datasource, no matter what I do.
Thanks
15 years, 6 months
Rewind Drools Flow
by jawa
Hi,
Is there anyway we can rewind the drools flow? I mean I save my flow in db
and at a later stage I want to rewind it and start it from some other node
instead of the one it was paused at. Has anyone tried this kind of thing
before?
I've got Human Tasks in my flow and my flow stops at one of the Human Task
and then resumes from it fine. But for a specific scenario I want my flow to
start from some other Node instead of the one it was paused at.
Thanks
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Rewind-Drools-Flow-tp...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 6 months
Is transaction management required for Drools process / session persistence
by Gustavo Tenrreiro
Hi,
I am trying to do Drools persistence in Tomcat with Hibernate, but it
would seem it also requires transaction management. Is that true?
In the meantime I tried to setup Bittronix to provide the transaction
management, but I can't get Hibernate to find the datasource at all.
I ve followed the BTM integration instructions for Tomcat, I ve also
done followed the BTM integration instructions for Hibernate, but
still nothing, Hibernate keeps saying it can't find the datasource.
Can anyone shed some light on this ?
BTW: my database is SQL Server
Thanks
15 years, 6 months
OptionalDataException reading compiled Packages
by Manish Shah
Not sure what happened with this post yesterday, another chain got started
with it, so trying again.
I have the application setup where the drl is generated from the database
and then written to the file system. So far i have been working with the
drl's without any problems but have run into issues while working with
packages.
Any help is much appreciated. Thanks.
Here is what i am doing while serializing the package.
PackageBuilder builder = new PackageBuilder();
builder.addPackageFromDrl(new StringReader(drl));
Package pkg = builder.getPackage();
DroolsStreamUtils.streamOut(new ObjectOutputStream(new FileOutputStream(new
File(fileName+".pkg"))), pkg);
i also tried the writeExternal on package, this genereate the file but got a
class cast exception while trying to load it.
The pkg file is generated and i dont think it has a problem unless i am
missing something in the above code.
Now, on the other side i am using drools-spring which sets up the agent on
startup. I was doing some trial and error and found two configurations that
worked but needed
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
to be in code, just the spring configuration didnt work (again if i am
missing something please let me know).
here are the spring configuration
First
<drools:kagent id="agent" kbase="base" new-instance="true"/>
<drools:kbase id="base">
<drools:resources>
<!--drools:resource type="DRL"
source="file:C:\file.drl"/--> //this works
<drools:resource type="PKG"
source="file:C:\file.pkg"/>
</drools:resources>
</drools:kbase-->
Second
<drools:kagent id="agent" kbase="base" new-instance="true">
<drools:resources>
<drools:resource type="CHANGE_SET"
source="file:C:\change-set.xml"/>
</drools:resources>
</drools:kagent>
<drools:kbase id="base"></drools:kbase>
and the changeset
<change-set...>
<add>
<resource source='file:/C:/file.pkg' type='PKG'/>
</add>
</change-set>
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/OptionalDataException...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 6 months
Purpose of field "Object" in DSL pattern definition?
by Wolfgang Laun
A DSL definition may have an "Object" entry which shows up in the
second pair of brackets, e.g.
[condition][object]Blah=Blah()
What is the purpose? None of the .dsl files in the 5.1 source has it filled in.
-W
15 years, 6 months
Database problem
by nch
Hi, there.
I need advice on how to approach the following. Hope I'm being clear:
- I have a database of over 30 tables.
- The database is being updated every now and then.
- I need to perform a bunch of calculations based on what's on the DB.
- Some of the calculations depend on intermediate calculations.
- I decided to use Drools in order to perform such calculations.
- Rules would take into account a wide range of factors.
- I know Drools is aware of facts that exist in its working memory only.
- On one hand I'd move the whole DB to the working memory in order to perform the calculations, but then I'd have to keep working memory and DB in sync.
- On the other hand I'd invoke Drools to perform specific calculations by passing it only relevant facts, but I think those relevant facts are a lot.
Should I try to keep DB and WM in sync? How? Should I try invoking Drools everytime I need a calculation? Are there any other alternatives?
Kind regards.
15 years, 6 months
comparing an intersection of sets..
by mechlife
Hi,
I have a situation where i need to evaluate a condition where the
intersection of 2 sets should atleast have one element in it. I am using
drools template to create the DRL and have a set B (item1,item2, item3,
item4). Now, at runtime i have a setA (item2, item5). the intersection of
the sets will have item2 and such should evaluate to true. I am currently
using evaluate to do a custom function but just wanted to check if there was
a way to do something like this by utilizing one of the existing keywords
available.
Any insight will be very appreciated. thanks for your time.
-ms
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/comparing-an-intersec...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 6 months
Implementation problems with long running WorkItems
by jschmied
Hi!
I have a flow where I call external webservices parallel from my own
WorkItemHandler. I have a ExecutorService and in executeWorkItem I submit a
Callable what does the work, so executeWorkItem return immediately. The
Callable calls workItemManager.completeWorkItem after the work is done.
As far as I can judge it works but I see the following problems:
- Is the workItemManager threadsafe? Can i call completeWorkItem() from a
other thread?
- In the parallel threads I do a ksession.insert(). Is this safe?
- Should I wrap the StatefulKnowledgeSession in a thread safe wrapper?
- fireAllRules does not wait for the process to finish but returns
immediately so I have to use fireUntilHalt. This uses one CPU core
completely. My solution is:
ProcessInstance prc = ksession.startProcess("Main");
while (prc.getState() == ProcessInstance.STATE_ACTIVE) {
Thread.sleep(100);
ksession.fireAllRules();
}
Is this OK or is there a better solution? I dont like polling ;-(.
Thanks!
juergen
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Implementation-proble...
Sent from the Drools - User mailing list archive at Nabble.com.
15 years, 6 months