Hi All, If I have a class (Someclass) that I want to receive Jess events, I assume that all I need to do (following JIA pp. 418-419 and the API) is the following:
1. Have that class implement the JessListener interface. 2. Have that class implement eventHappened(JessEvent je). 3. Instantiate a Rete object with engine = new Rete(Someclass.class) to register the context with engine. 3. Register that class to receive events via engine.addJessListener(). 4. Call engine.setEventMask() for each event that I want to receive. I tried all this and didn't have any luck, so I'm obviously missing something. Now, for simplicity sake, let's say that Someclass contains a method called process() where: public void process() { engine.executeCommand("(batch main.clp)"); engine.executeCommand("(batch resolve.clp)"); engine.executeCommand("(batch schedule.clp)"); engine.reset(); engine.runUntilHalt(); } Now, I have a slew of questions: 1. While runUntilHalt() is executing, does the listening class need to be listening on another thread to receive events while the engine is running? 2. Does it matter at all that process() is running Jess script via engine.executeCommand() instead of executing API code directly? 3. Is this an acceptable way of programming in Jess? Should all the script be in one file? 4. My main reason for wanting the events produced by Jess was to log them for debugging. (Jess is being used in a webapp here, and I am using Apache Jakarta Log4J as the logger.) My initial thought was to put logging statements in the implementation of eventHappened() like this: public void eventHappened(JessEvent je) throws JessException { switch (je.getType()) { case JessEvent.ACTIVATION: Activation activation = (Activation) je.getObject(); String ruleName = activation.getRule().getDisplayName(); logger.info("Activation: " + ruleName + " was activated or deactivated."); break; // ... more code } What's the best way of logging Jess output and events when Jess is embedded in a web application? (I don't mean generating JSP views for input/output - that I've got fine.) Thanks! -JM ------------------------ Jason Morris Morris Technical Solutions [EMAIL PROTECTED] www.morristechnicalsolutions.com fax/phone: 503.692.1088 -------------------------------------------------------------------- To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]' in the BODY of a message to [EMAIL PROTECTED], NOT to the list (use your own address!) List problems? Notify [EMAIL PROTECTED] --------------------------------------------------------------------