use of org.drools.core.rule.SlidingTimeWindow.BehaviorJobContext in project drools by kiegroup.
the class BehaviorJobContextTimerOutputMarshaller method serialize.
@Override
public ProtobufMessages.Timers.Timer serialize(JobContext jobCtx, MarshallerWriteContext outputCtx) {
// BehaviorJob, no state
BehaviorJobContext bjobCtx = (BehaviorJobContext) jobCtx;
// write out SlidingTimeWindowContext
SlidingTimeWindowContext slCtx = (SlidingTimeWindowContext) bjobCtx.behaviorContext;
EventFactHandle handle = slCtx.peek();
return ProtobufMessages.Timers.Timer.newBuilder().setType(ProtobufMessages.Timers.TimerType.BEHAVIOR).setBehavior(ProtobufMessages.Timers.BehaviorTimer.newBuilder().setHandleId(handle.getId()).build()).build();
}
use of org.drools.core.rule.SlidingTimeWindow.BehaviorJobContext in project drools by kiegroup.
the class BehaviorJobContextTimerOutputMarshaller method write.
public void write(JobContext jobCtx, MarshallerWriteContext outputCtx) throws IOException {
outputCtx.writeShort(PersisterEnums.BEHAVIOR_TIMER);
// BehaviorJob, no state
BehaviorJobContext bjobCtx = (BehaviorJobContext) jobCtx;
// write out SlidingTimeWindowContext
SlidingTimeWindowContext slCtx = (SlidingTimeWindowContext) bjobCtx.behaviorContext;
EventFactHandle handle = slCtx.peek();
outputCtx.writeLong(handle.getId());
}
Aggregations