Problem with simple Fusion test case
by RobinMacharg
Hi,
I'm new to Drools (this is my first post) and am running into problems
understanding the temporal aspects of it.
I am trying to create a simple test case, using the pseudo-clock to control
time. I declare and add a number of events with different start times
(@timestamp) and durations (@duration). I'd then like to advance the
pseudo-clock by hand, calling fireAllRules() between clock-ticks. I have a
single rule that I would hope would fire on events that are 'valid', i.e.
their (start_time < clock) and their (start_time + duration > clock). I'm
seeing ALL events being picked up the first time I fireAllRules(). I'd
really appreciate an explanation of what I'm missing here.
Some code:
I have a POJO Event class:
public class Event {
public String name;
public long start;
public long dur;
//... constructor, getters, setters omitted for brevity
}
I have a .drl file with an event declaration and a single rule in it:
package myPackage.Event
import myPackage.Event
declare Event
@role( event )
@timestamp ( start )
@duration ( dur )
end
rule "events"
when
e : Event()
then
System.out.println(e.name);
end
My scaffolding creates a STREAM based, pseudo-clock configured stateful
KnowledgeSession, and reads the .drl rules using the standard code from the
examples. I create a number of Events:
Event e1 = new Event("myEvent1", 0, 1000);
Event e2 = new Event("myEvent1", 10000, 20000);
ksession.insert(e1)
... etc.
Then I fireAllRules(), advance the clock and fire them again. I'm seeing
the second event being matched on the first fireAllRules(). I'd not have
expected it to fire until the clock > 10000. I'm sure Drools is doing the
right thing, and I'm not, but I can't work out what. The examples of the
temporal operators all refer to a second event to be compared to. Also, I
can't find an example of referencing the drools system clock value (in this
case the pseudo-clock) from within a rule match section.
So, what am I doing wrong? If I can make my example clearer please let me
know.
Thanks in advance,
Robin
--
View this message in context: http://drools.46999.n3.nabble.com/Problem-with-simple-Fusion-test-case-tp...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Changes are not reflected
by ponmanirajan
hi ,
i have the changeset file as below for scanning the directory of drl
files.
<change-set xmlns="http://drools.org/drools-5.0/change-set"
xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
xs:schemaLocation="http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/...">
<add>
<resource source="file:/D:/users/myrules" type="DRL"/>
</add>
</change-set>
Here, i have my agent configuration code.
KnowledgeAgentConfiguration kaconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories","true" );
kaconf.setProperty( "drools.agent.newInstance","false" );
kagent =KnowledgeAgentFactory.newKnowledgeAgent( "test agent", kaconf );
System.out.println("Before Applying ChangeSet");
kagent.applyChangeSet(ResourceFactory.newFileResource("D:/users/ChangeSet.xml"));
System.out.println("After Applying Change Set");
ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "5");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeNotifierService().start();
ResourceFactory.getResourceChangeScannerService().start();
It loads the drl files. But when i made changes to a drl file, it is not
reflected.
can anyone help me to find out the solution .
thanks in advance....
--
View this message in context: http://drools.46999.n3.nabble.com/Changes-are-not-reflected-tp3917286p391...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
"java.lang.AbstractMethodError: org.jbpm.marshalling.impl.ProcessMarshallerImpl.init" while unmarshalling statefulknowledgesession
by sumatheja
Hi All,
I ran across an issue while unmarshalling StatefulKnowledgeSession.
First I'm marshalling the session using the following code which works fine
Marshaller marshaller = MarshallerFactory
.newMarshaller(workingMemory.getKnowledgeBase());
File file = new File(
"C:\\Users\\Sumatheja\\workingmemory.info");
FileOutputStream fos = new FileOutputStream(file);
ByteArrayOutputStream baos = new
ByteArrayOutputStream();
marshaller.marshall(baos, workingMemory);
baos.writeTo(fos);
baos.close();
When I try to unmarshall the session using
Marshaller marshaller = MarshallerFactory
.newMarshaller(workingMemory.getKnowledgeBase());
FileInputStream fis = new
FileInputStream("C:\\Users\\Sumatheja\\workingmemory.info");
workingMemory = marshaller.unmarshall(fis);
I'm getting the Error:
java.lang.AbstractMethodError:
org.jbpm.marshalling.impl.ProcessMarshallerImpl.init(Lorg/drools/marshalling/impl/MarshallerReaderContext;)V
at
org.drools.marshalling.impl.PersisterHelper.buildRegistry(PersisterHelper.java:287)
at
org.drools.marshalling.impl.ProtobufInputMarshaller.loadAndParseSession(ProtobufInputMarshaller.java:219)
at
org.drools.marshalling.impl.ProtobufInputMarshaller.readSession(ProtobufInputMarshaller.java:152)
at
org.drools.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:117)
at
org.drools.marshalling.impl.ProtobufMarshaller.unmarshall(ProtobufMarshaller.java:86)
at
mattelli.re.ComplianceEngine.ComplianceRunService(ComplianceEngine.java:271)
at mattelli.re.ComplianceEngine.main(ComplianceEngine.java:84)
No Idea what I'm missing out... any help will be appreciated... Thanks in
advance
--
cheers
Sumatheja Dasararaju
12 years, 7 months
Planner: weighting moves & adaptive foragers
by Christopher Dolan
Three related questions about Drools Planner:
My planning problem involves distributing N jobs into M job queues. The optimal queue ordering depends on a large number of factors, but most important are job priority and job age. Priority usually wins, but old jobs can trump to avoid starvation.
If N x M is large, the collection of possible moves becomes large. But I know a priori that some moves are more likely to help than others. For example, I can promote the high-priority and old jobs first, because they will have the largest score impact.
1) Can I weight the selector to pick the better moves first? It looks like I'd make a custom AbstractSelector subclass that shuffled differently from MoveFactorySelector, maybe lazily finding moves via a pick function.
Of course, selecting better moves first is worthless if the forager doesn't use shortcuts, like FIRST_BEST_SCORE_IMPROVING. But the existing AcceptingForager implementation is very binary: it either takes the first good score or it ignores score and waits for a total number of moves.
2) Has anyone built a generic Forager that looks at the distribution of scores and stops early if it finds a fantastic outlier? In particular, early in the solver there are lots of very easy improvements to make. Taking the first good one may be premature, but going through 1000 moves is a waste of time. I'd like a forager that just tries a few moves early and then tries more moves later on when it's harder to make gains. On the other hand, is putting a lot of work into a perfect forager just redundant with the acceptor?
3) Has anyone employed the undocumented TopListSelector? I'm intrigued that it feeds the forager's best moves back into the selector. How does it work? I think you need to combine it with a move factory to seed the solutions, but then it's redundant with that factory's output. Are selectors allowed to return the same move twice??
Chris
12 years, 7 months
Guvnor Rest API
by Amin Mohammed-Coleman
Hi
I am trying to use the Guvnor Rest API to upload rules and BPMN process definitions to a remote Guvnor installation. So far I am able to update the binary content of the asset using:
/drools-guvnor/rest/packages/myPackage/assets/myAsset/binary
However when I look at the history for the asset, the current version does not point to the version I have uploaded using the API. Is there a separate API I have to call in order to set the current version to be the one I've uploaded or is there an example which I can reference?
I'm using Guvnor 5.4.0-CR1
Any help would be appreciated.
Thanks
12 years, 7 months
Issue deploying 2.1 oryxdesigner on guvnor 5.4 CR1 and jboss 7.1.1 final
by sumatheja
Hi I deployed the designer 2.1 war in standalone/deployments afetr changing
the url in the jbpm.xml to the appropriate port.
* <externalloadurl protocol="http" host="localhost:8380"
subdomain="drools-guvnor/org.drools.guvnor.Guvnor/oryxeditor" usr="admin"
pwd="admin"/>*
When I create a new jbpm and save it nothing happens.. I get the following
server log.... Can anyone let me knoe if it is a bug or If I'm missing
anything.....
*17:00:14,356 INFO [stdout] (http--127.0.0.1-8380-2) (null: -1, -1):
Premature end of file.
17:00:17,997 INFO [org.jbpm.designer.server.EditorHandler]
(http--127.0.0.1-8380-10) Performing diagram information pre-processing
steps.
17:00:18,027 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:18,251 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:18,369 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:18,598 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:18,682 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:18,765 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--127.0.0.1-8380-10) Successfully deleted file
:C:\Users\Sumatheja\mywork\jboss-
as-7.1.1.Final\standalone\deployments\designer.war\stencilsets/bpmn2.0jbpm/bpmn2.0jbpm.json
17:00:18,821 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--127.0.0.1-8380-10) Created
file:C:\Users\Sumatheja\mywork\jboss-as-7.1.1.Final
\standalone\deployments\designer.war\stencilsets/bpmn2.0jbpm/bpmn2.0jbpm.json
17:00:18,827 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--127.0.0.1-8380-10) Successfully deleted file
:C:\Users\Sumatheja\mywork\jboss-
as-7.1.1.Final\standalone\deployments\designer.war\stencilsets\bpmn2.0jbpm\view\activity\workitems\Email.svg
17:00:18,833 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--127.0.0.1-8380-10) Successfully deleted file
:C:\Users\Sumatheja\mywork\jboss-
as-7.1.1.Final\standalone\deployments\designer.war\stencilsets\bpmn2.0jbpm\view\activity\workitems\Log.svg
17:00:18,860 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--127.0.0.1-8380-10) Created
file:C:\Users\Sumatheja\mywork\jboss-as-7.1.1.Final
\standalone\deployments\designer.war\stencilsets/bpmn2.0jbpm/view/activity/workitems/Log.svg
17:00:18,874 INFO
[org.jbpm.designer.web.preprocessing.impl.JbpmPreprocessingUnit]
(http--127.0.0.1-8380-10) Created
file:C:\Users\Sumatheja\mywork\jboss-as-7.1.1.Final
\standalone\deployments\designer.war\stencilsets/bpmn2.0jbpm/view/activity/workitems/Email.svg
17:00:19,647 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:19,660 INFO [stdout] (http--127.0.0.1-8380-5) (null: -1, -1):
Premature end of file.
17:00:20,478 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:20,744 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:21,134 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:21,436 INFO [org.drools.guvnor.server.security.DemoAuthenticator]
(http--127.0.0.1-8380-5) Demo login for user (admin) succeeded.
17:00:21,439 WARNING
[org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper]
(http--127.0.0.1-8380-5) WebApplicationException has been caught :
javax.jcr.PathNotFoundE
xception: processdictionary
17:00:21,443 INFO [org.jbpm.designer.web.server.DictionaryServlet]
(http--127.0.0.1-8380-2) check connection response code: 500*
Appreciate any help..... thanks in advance
--
cheers
Sumatheja Dasararaju
12 years, 7 months
SOAP rule invocation in droolsjbpm-integration-distribution-5.4.0.CR1
by Oldrich Kotas
Hello,
I am trying to invoke rules in the sample integration deployment from
drools-camel-server-5.4.0.CR1 release.
No matter what I keep sending to the endpoint, only following returns:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>org.apache.cxf.binding.soap.SoapMessage cannot be cast
to java.lang.String</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
I have the server running on
http://localhost:8080/drools-camel-server-5.4.0.CR1/kservice/soap, the WSDL
downloads faultlessly. What is puzzling me, the very same request were
working in version 5.3. The deployment in regard of Camel is completely
intact with only chages whatsoever being specification of the Agent
knowledge-services.xml.
My sample request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soap="http://soap.jax.drools.org/">
<soapenv:Header/>
<soapenv:Body>
<soap:execute>
<soap:arg0>
</soap:arg0>
</soap:execute>
</soapenv:Body>
</soapenv:Envelope>
A side note: In 5.3.0.Final I have not succeed in making the Knowledge Agent
to sniff on Guvnor to get up-to-date packages therefore I tried last version
with the troubles reportedly repaired.
A side note 2: I have found in the drools-camel-server-5.4.0.CR1
documentation, chapter 3.3.1.2 a statement indicating the SOAP support is
not bundled in yet, is that correct or a remnant of some old version?
Citation: "If you want to have SOAP support you need to create your custom
Drools Policy, but it's going to be added in the next release."
Is there perhaps a fault in the camel/cxf configuration or the function is
just not implemented yet?
Help is very appreciated. Thank you,
Oldrich
--
View this message in context: http://drools.46999.n3.nabble.com/SOAP-rule-invocation-in-droolsjbpm-inte...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months
Creating and consuming processes in Guvnor programmatically
by affandar
In one of our scenarios we need to create a few workflows on the fly, upload
them to the guvnor repository and make them available to the jBPM engine
which is reading from this guvnor repository.
I was able to upload the process to Guvnor by posting the bpmn file to its
webdav endpoint but was not able to find a way to publish the package.
Questions:
1) Is there a better way to upload new processes to the Guvnor repo?
2) How do I publish a package programmatically?
Thanks
--
View this message in context: http://drools.46999.n3.nabble.com/Creating-and-consuming-processes-in-Guv...
Sent from the Drools: User forum mailing list archive at Nabble.com.
12 years, 7 months