Cloudera CDH/CDP 및 Hadoop EcoSystem, Semantic IoT등의 개발/운영 기술을 정리합니다. gooper@gooper.com로 문의 주세요.
-----------CustomWorkingMemoryEventListener.java---------------
package com.gooper.drool_test;
import org.kie.api.event.rule.ObjectDeletedEvent;
import org.kie.api.event.rule.ObjectInsertedEvent;
import org.kie.api.event.rule.ObjectUpdatedEvent;
import org.kie.api.event.rule.WorkingMemoryEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/*
* 워킹 메모리에 대한 정보
*/
public class CustomWorkingMemoryEventListener implements WorkingMemoryEventListener {
private static final Logger logger = LoggerFactory.getLogger(CustomWorkingMemoryEventListener.class);
@Override
public void objectDeleted(ObjectDeletedEvent event) {
logger.info("Object Deleted : "+ event.getFactHandle() + " Knowledge Runtime: "+event.getKieRuntime());
}
@Override
public void objectInserted(ObjectInsertedEvent event) {
logger.info("Object Inserted : "+ event.getFactHandle() + " Knowledge Runtime: "+event.getKieRuntime());
}
@Override
public void objectUpdated(ObjectUpdatedEvent event) {
logger.info("Object Updated : "+ event.getFactHandle() + " Knowledge Runtime: "+event.getKieRuntime());
}
}