[rules-users] How to monitor drools execution time?

2011-11-13 Thread Zhao Yi
I want to check how long each rule executed. Can I add any listener on drools
run time to get the rule time?

Thanks,
Zhao Yi

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-monitor-drools-execution-time-tp3505792p3505792.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] How to monitor drools execution time?

2011-11-13 Thread Benson Fung
You can use the Drools guvnor to measure the execution time of each rule.
This is the feature of that.



On Mon, Nov 14, 2011 at 11:00 AM, Zhao Yi zhaoyi0...@gmail.com wrote:

 I want to check how long each rule executed. Can I add any listener on
 drools
 run time to get the rule time?

 Thanks,
 Zhao Yi

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/How-to-monitor-drools-execution-time-tp3505792p3505792.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] How to monitor drools execution time?

2011-11-13 Thread Davide Sottara
Sure, you can use

/ksession.addEventListener( listener )/

to add your listeners. You'll have to implement the /AgendaEventListener/
interface: in particular, the /beforeActivationFired/ and
/afterActivationFired/ handlers.
If needed, the /WorkingMemoryEventListener/ will let you monitor object
insertions and retractions.

You can also see section 4.3.5 in the Drools Expert User Guide for more
details.

Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-monitor-drools-execution-time-tp3505792p3505821.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] How to run an agenda group multiple times?

2011-11-13 Thread Davide Sottara
Were the rules in the agenda group entitled to fire more than once? For a
rule to fire, it must be activated by the insertion, update or (sometimes)
retraction of one or more objects. Once a rule has fired, it can't fire
again until it gets activated again. An agenda-group can be used to
/prevent/ an active rule from firing (if the rule belongs to a non-focused
group), but can't make a rule fire again
Davide

--
View this message in context: 
http://drools.46999.n3.nabble.com/How-to-run-an-agenda-group-multiple-times-tp3504139p3505831.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] String length check

2011-11-13 Thread Davide Sottara
I'd also use the int 8 instead of the String 8 :)

--
View this message in context: 
http://drools.46999.n3.nabble.com/String-length-check-tp3502269p3505833.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] Help needed - Repository not getting initialised?

2011-11-13 Thread Praveen
Hi,

Repository is not getting initialised, throws NPE.
Please advise.
TIA.

public static Repository repository;

public static Session getSession() throws Exception {
return getSession(true);
}

public static synchronized Session getSession(boolean erase) {
try {
if (repository == null) {

if (erase) {
File repoDir = new File(repository);
System.out.println(DELETE test repo dir: 
+ repoDir.getAbsolutePath());
RepositorySessionUtil.deleteDir(repoDir);
System.out.println(TEST repo dir deleted.);
}

JCRRepositoryConfigurator config = new
JackrabbitRepositoryConfigurator();
String home = System
.getProperty(guvnor.repository.dir);
  
repository = config.getJCRRepository(home);

Session testSession = repository
.login(new SimpleCredentials(alan_parsons,
password.toCharArray()));

RulesRepositoryAdministrator admin = new
RulesRepositoryAdministrator(
testSession);
if (erase  admin.isRepositoryInitialized()) {

admin.clearRulesRepository();
}
config.setupRulesRepository(testSession);
return testSession;
} else {
return repository.login(new SimpleCredentials(
alan_parsons, password.toCharArray()));
}
} catch (RepositoryException e) {
throw new IllegalStateException(e);
}

}

public static void main(String [] args) throws Exception{
getSession();
}


Below is the exception..

DELETE test repo dir: D:\drools\TestRepository\repository
TEST repo dir deleted.
Exception in thread main java.lang.NullPointerException: dispatcher
at
org.apache.jackrabbit.core.observation.ObservationManagerImpl.init(ObservationManagerImpl.java:97)
at
org.apache.jackrabbit.core.WorkspaceImpl.getObservationManager(WorkspaceImpl.java:748)
at
org.apache.jackrabbit.core.SessionImpl.removeRegisteredEventListeners(SessionImpl.java:1193)
at org.apache.jackrabbit.core.SessionImpl.logout(SessionImpl.java:1222)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.doDispose(RepositoryImpl.java:2194)
at
org.apache.jackrabbit.core.RepositoryImpl$WorkspaceInfo.dispose(RepositoryImpl.java:2149)
at
org.apache.jackrabbit.core.RepositoryImpl.doShutdown(RepositoryImpl.java:1175)
at
org.apache.jackrabbit.core.RepositoryImpl.shutdown(RepositoryImpl.java:1127)
at
org.apache.jackrabbit.core.RepositoryImpl.initStartupWorkspaces(RepositoryImpl.java:544)
at
org.apache.jackrabbit.core.RepositoryImpl.init(RepositoryImpl.java:366)
at
org.apache.jackrabbit.core.RepositoryImpl.create(RepositoryImpl.java:673)
at
org.apache.jackrabbit.core.TransientRepository$2.getRepository(TransientRepository.java:231)
at
org.apache.jackrabbit.core.TransientRepository.startRepository(TransientRepository.java:279)
at
org.apache.jackrabbit.core.TransientRepository.login(TransientRepository.java:375)
at
org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123)
at Hello.getSession(Hello.java:50)
at Hello.getSession(Hello.java:27)
at Hello.main(Hello.java:72)


Regards,
Praveen.

--
View this message in context: 
http://drools.46999.n3.nabble.com/Help-needed-Repository-not-getting-initialised-tp3506064p3506064.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] String length check

2011-11-13 Thread lansyj
@Davide, I'm using the guided editor and I am putting the value as 8 But the
generated source shows 8. Not sure of this is a defect in Drools or
something that I'm doing incorrectly.

--
View this message in context: 
http://drools.46999.n3.nabble.com/String-length-check-tp3502269p3506079.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] [rule engine advantage?]Logic and Data Separation - how to archieve the transparent domain/fact object insertion?

2011-11-13 Thread kapokfly
Logic and Data Separation
Your data is in your domain objects, the logic is in the rules. This is
fundamentally breaking the
OO coupling of data and logic, which can be an advantage or a disadvantage
depending on
your point of view. The upshot is that the logic can be much easier to
maintain as there are
changes in the future, as the logic is all laid out in rules. This can be
especially true if the logic
is cross-domain or multi-domain logic. Instead of the logic being spread
across many domain
objects or controllers, it can all be organized in one or more very distinct
rules files.


The current practice we are following demonstrate a strong relationship
between fact objects and the rule files itself, the rule needs to understand
what fact object available in the working memory and the working memory may
also consider what kind of rules can be written against objects in memory
thus the application developers need insert/write rules carefully and better
to be done by 1 developer (or we can say, depends on how the rule is
written, it will impact what objects/how objects are being inserted into the
working memory). 

Can someone share their experiences how to make the knowledge session/fact
object maintenance work as transparent as possible? how to decouple the fact
object maintenance work from the rules? At which layer you usually insert
fact object to the work memory? 

Ivan   




-
Ivan, your Panda, forever
--
View this message in context: 
http://drools.46999.n3.nabble.com/rule-engine-advantage-Logic-and-Data-Separation-how-to-archieve-the-transparent-domain-fact-object-i-tp3506131p3506131.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] Email Service

2011-11-13 Thread ANJALI
Hi guys,
  Iam trying to send email through drools by using bpmn.xml...in
order to do so i need to register a work item handler into my session.

I have done in this way

 ksession.getWorkItemManager().registerWorkItemHandler(Email,
emailWorkItemHandler);

And this is my class for that handler

 public class  NotificationWorkItemHandler implements
WorkItemHandler {


  public void executeWorkItem(WorkItem workItem, WorkItemManager 
manager) {

// extract parameters

String from = (String) workItem.getParameter(From);

String to = (String) workItem.getParameter(To);

String message = (String) workItem.getParameter(Message);

String priority = (String) workItem.getParameter(Priority);

// send email

*EmailService service =
ServiceRegistry.getInstance().getEmailService();*

service.sendEmail(from, to, Notification, message);

// notify manager that work item has been completed

manager.completeWorkItem(workItem.getId(), null);

  }

My issue is Email service need some import but I cant see what needs to be
included
Could any one help me out in this issue?


Thanks in advance 
Anjali



--
View this message in context: 
http://drools.46999.n3.nabble.com/Email-Service-tp3506142p3506142.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] String length check

2011-11-13 Thread Michael Anstis
Guvnor used to escape all literals with quotation marks before 5.2.

There have been numerous fixes to the BRL Guided Editor for 5.2 onwards. I
would definitely recommend an upgrade.

Can you please advise if you used an expression for your nested accessor or
sub-field constraints?

Thanks,

Mike

On 14 November 2011 06:46, lansyj lans...@gmail.com wrote:

 @Davide, I'm using the guided editor and I am putting the value as 8 But
 the
 generated source shows 8. Not sure of this is a defect in Drools or
 something that I'm doing incorrectly.

 --
 View this message in context:
 http://drools.46999.n3.nabble.com/String-length-check-tp3502269p3506079.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