Class SubscriptionPublisher
- java.lang.Object
-
- org.openmetadata.service.events.subscription.AbstractAlertPublisher
-
- org.openmetadata.service.events.subscription.SubscriptionPublisher
-
- All Implemented Interfaces:
com.lmax.disruptor.EventHandler<EventPubSub.ChangeEventHolder>,com.lmax.disruptor.LifecycleAware,EventPublisher
- Direct Known Subclasses:
EmailPublisher,GChatPublisher,GenericPublisher,MSTeamsPublisher,SlackEventPublisher
public class SubscriptionPublisher extends AbstractAlertPublisher
SubscriptionPublisher publishes events to the alert endpoint using POST http requests/ Email. There is one instance of SubscriptionPublisher per alert subscription. Each SubscriptionPublisher is an EventHandler that runs in a separate thread and receives events from LMAX DisruptorEventPubSubthroughBatchEventProcessor.The failures during callback to Alert are handled in this class as follows:
- Alerts with unresolvable URLs are marked as "failed" and no further attempt is made to deliver the events
- Alerts callbacks that return 3xx are marked as "failed" and no further attempt is made to deliver the events
- Alerts callbacks that return 4xx, 5xx, or timeout are marked as "awaitingRetry" and 5 retry attempts are made to deliver the events with the following backoff - 3 seconds, 30 seconds, 5 minutes, 1 hours, and 24 hour. When all the 5 delivery attempts fail, the alerts state is marked as "retryLimitReached" and no further attempt is made to deliver the events.
-
-
Field Summary
-
Fields inherited from class org.openmetadata.service.events.subscription.AbstractAlertPublisher
BACKOFF_1_HOUR, BACKOFF_24_HOUR, BACKOFF_3_SECONDS, BACKOFF_30_SECONDS, BACKOFF_5_MINUTES, BACKOFF_NORMAL, batch, currentBackoffTime, eventSubscription
-
-
Constructor Summary
Constructors Constructor Description SubscriptionPublisher(EventSubscription eventSub)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidawaitShutdown()intgetCurrentBackOff()EventSubscriptiongetEventSubscription()voidonShutdown()protected voidonShutdownDelegate()voidonStart()protected voidonStartDelegate()voidpublish(EventResource.EventList list)protected voidsendAlert(EventResource.EventList list)voidsetAwaitingRetry(Long attemptTime, int statusCode, String reason)voidsetErrorStatus(Long attemptTime, Integer statusCode, String reason)voidsetProcessor(com.lmax.disruptor.BatchEventProcessor<EventPubSub.ChangeEventHolder> processor)protected SubscriptionStatussetStatus(SubscriptionStatus.Status status, Long attemptTime, Integer statusCode, String reason, Long timestamp)SubscriptionStatussetSuccessStatus(Long updateTime)-
Methods inherited from class org.openmetadata.service.events.subscription.AbstractAlertPublisher
onEvent, setNextBackOff
-
-
-
-
Constructor Detail
-
SubscriptionPublisher
public SubscriptionPublisher(EventSubscription eventSub)
-
-
Method Detail
-
onStart
public void onStart()
-
onShutdown
public void onShutdown()
-
getEventSubscription
public EventSubscription getEventSubscription()
-
setSuccessStatus
public SubscriptionStatus setSuccessStatus(Long updateTime)
-
setStatus
protected SubscriptionStatus setStatus(SubscriptionStatus.Status status, Long attemptTime, Integer statusCode, String reason, Long timestamp)
-
awaitShutdown
public void awaitShutdown() throws InterruptedException- Throws:
InterruptedException
-
setProcessor
public void setProcessor(com.lmax.disruptor.BatchEventProcessor<EventPubSub.ChangeEventHolder> processor)
-
sendAlert
protected void sendAlert(EventResource.EventList list) throws InterruptedException
- Throws:
InterruptedException
-
onStartDelegate
protected void onStartDelegate()
-
onShutdownDelegate
protected void onShutdownDelegate()
-
getCurrentBackOff
public int getCurrentBackOff()
-
publish
public void publish(EventResource.EventList list) throws EventPublisherException
- Throws:
EventPublisherException
-
-