Package org.yamcs.events
Class AbstractEventProducer
- java.lang.Object
-
- org.yamcs.events.AbstractEventProducer
-
- All Implemented Interfaces:
EventProducer
- Direct Known Subclasses:
MockupEventProducer
,QuietEventProducer
,Slf4jEventProducer
,StreamEventProducer
public abstract class AbstractEventProducer extends Object implements EventProducer
Default implementation of an EventProducer that provides shortcut methods for sending message of different severity types.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
logAllMessages
-
Constructor Summary
Constructors Constructor Description AbstractEventProducer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
flushEventBuffer(boolean startNewSequence)
abstract long
getMissionTime()
Db.Event.Builder
newEvent()
Creates a default Event Builder with these fields pre-filled: source, seqNo, receptionTime, generationTimevoid
sendCritical(String msg)
send an critical event with the type automatically filled in as the caller class namevoid
sendCritical(String type, String msg)
void
sendDistress(String msg)
send an distress event with the type automatically filled in as the caller class namevoid
sendDistress(String type, String msg)
void
sendError(String type, String msg)
void
sendInfo(String msg)
send an info event with the type automatically filled in as the caller class namevoid
sendInfo(String type, String msg)
void
sendSevere(String msg)
send an severe event with the type automatically filled in as the caller class namevoid
sendSevere(String type, String msg)
void
sendWarning(String msg)
send an warning event with the type automatically filled in as the caller class namevoid
sendWarning(String type, String msg)
Send a warning event with the given typevoid
sendWatch(String msg)
send an watch event with the type automatically filled in as the caller class namevoid
sendWatch(String type, String msg)
void
setRepeatedEventReduction(boolean repeatedEventReduction, long repeatedEventTimeoutMillisec)
By default event repetitions are checked for possible reduction.void
setSeqNo(int sn)
void
setSource(String source)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.yamcs.events.EventProducer
close, sendEvent
-
-
-
-
Method Detail
-
setSource
public void setSource(String source)
- Specified by:
setSource
in interfaceEventProducer
-
setSeqNo
public void setSeqNo(int sn)
- Specified by:
setSeqNo
in interfaceEventProducer
-
sendError
public void sendError(String type, String msg)
- Specified by:
sendError
in interfaceEventProducer
-
sendWarning
public void sendWarning(String type, String msg)
Description copied from interface:EventProducer
Send a warning event with the given type- Specified by:
sendWarning
in interfaceEventProducer
-
sendInfo
public void sendInfo(String type, String msg)
- Specified by:
sendInfo
in interfaceEventProducer
-
sendWatch
public void sendWatch(String type, String msg)
- Specified by:
sendWatch
in interfaceEventProducer
-
sendDistress
public void sendDistress(String type, String msg)
- Specified by:
sendDistress
in interfaceEventProducer
-
sendCritical
public void sendCritical(String type, String msg)
- Specified by:
sendCritical
in interfaceEventProducer
-
sendSevere
public void sendSevere(String type, String msg)
- Specified by:
sendSevere
in interfaceEventProducer
-
sendInfo
public void sendInfo(String msg)
Description copied from interface:EventProducer
send an info event with the type automatically filled in as the caller class name- Specified by:
sendInfo
in interfaceEventProducer
- Parameters:
msg
- - event message
-
sendWatch
public void sendWatch(String msg)
Description copied from interface:EventProducer
send an watch event with the type automatically filled in as the caller class name- Specified by:
sendWatch
in interfaceEventProducer
- Parameters:
msg
- - event message
-
sendWarning
public void sendWarning(String msg)
Description copied from interface:EventProducer
send an warning event with the type automatically filled in as the caller class name- Specified by:
sendWarning
in interfaceEventProducer
- Parameters:
msg
- - event message
-
sendCritical
public void sendCritical(String msg)
Description copied from interface:EventProducer
send an critical event with the type automatically filled in as the caller class name- Specified by:
sendCritical
in interfaceEventProducer
- Parameters:
msg
- - event message
-
sendDistress
public void sendDistress(String msg)
Description copied from interface:EventProducer
send an distress event with the type automatically filled in as the caller class name- Specified by:
sendDistress
in interfaceEventProducer
- Parameters:
msg
- - event message
-
sendSevere
public void sendSevere(String msg)
Description copied from interface:EventProducer
send an severe event with the type automatically filled in as the caller class name- Specified by:
sendSevere
in interfaceEventProducer
- Parameters:
msg
- - event message
-
setRepeatedEventReduction
public void setRepeatedEventReduction(boolean repeatedEventReduction, long repeatedEventTimeoutMillisec)
By default event repetitions are checked for possible reduction. Disable if 'realtime' events are required.- Specified by:
setRepeatedEventReduction
in interfaceEventProducer
- Parameters:
repeatedEventReduction
- if true - enable the reduction of events.repeatedEventTimeoutMillisec
- - how long to keep quiet in case of equal events being sent
-
flushEventBuffer
protected void flushEventBuffer(boolean startNewSequence)
-
newEvent
public Db.Event.Builder newEvent()
Description copied from interface:EventProducer
Creates a default Event Builder with these fields pre-filled: source, seqNo, receptionTime, generationTime- Specified by:
newEvent
in interfaceEventProducer
-
getMissionTime
public abstract long getMissionTime()
-
-