Hello all,
I am new to Jess and I am trying to use it to apply rules against network
events (such as SNMP traps).  I have been able to apply rules to the events
by placing the events in a Queue and modifying a count property in a
TrapListener class.  The TrapListener class uses a PropertyChangeSupport
object to notify Jess of changes to the count (via firePropertyChange)
similiar to the "jess/examples/simple/Simple.java" code.  The rules work
fine as long as multiple events do not come in at the same time.  However,
if events come in rapidly (which is generally the case with network events),
the rule "new-event" does not always fire.  I have tried various
synchronization techniques to no avail.

The rules look something like:
....
(deftemplate jobject (slot class) (slot OBJECT))
(defclass traplstn TrapListener extends jobject)
(defclass trapd Trapd extends jobject)

;; This rule will fire any time an event comes in and prints out the count
(defrule new-event
  (traplstn (count ?count) )
  =>
  (printout t "ALERT: received trap, count is " ?count crlf)
  )

(defrule startup
  =>
  ;; Instantiate the daemon
  (definstance trapd (bind ?thetrapd (new Trapd)))
  ;; Instantiate a listener to the daemon which queues up the traps
  (definstance traplstn (bind ?thetraplstn (new TrapListener)))
  ;; Add the queue from the TrapListener for thetrapd to send
  ;; The count is incremented and set every time an event comes in.
  (call ?thetrapd addListener (?thetraplstn getQueue))
  )

(reset)
;; we must "run-until-halt" b/c there will be nothing on the agenda
;; until an event comes in
(run-until-halt)
......

Ideas, anyone?

Thanks,
Grant

---------------------------------------------------------------------
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]
---------------------------------------------------------------------

Reply via email to