+ @Getter
+ private final String producerSupervisionCallbackUrl;
+
+ private int unresponsiveCounter = 0;
+
+ public EiProducer(String id, Collection<EiType> eiTypes, String jobCallbackUrl,
+ String producerSupervisionCallbackUrl) {
+ this.id = id;
+ this.eiTypes = eiTypes;
+ this.jobCallbackUrl = jobCallbackUrl;
+ this.producerSupervisionCallbackUrl = producerSupervisionCallbackUrl;
+ }
+
+ public synchronized void setAliveStatus(boolean isAlive) {
+ if (isAlive) {
+ unresponsiveCounter = 0;
+ } else {
+ unresponsiveCounter++;
+ }
+ }
+
+ public synchronized boolean isDead() {
+ return this.unresponsiveCounter >= 3;
+ }
+
+ public synchronized boolean isAvailable() {
+ return this.unresponsiveCounter == 0;
+ }