Search in sources :

Example 1 with UpdateTableMessage

use of com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTableMessage in project metacat by Netflix.

the class SNSNotificationServiceImpl method notifyOfTableRename.

/**
     * {@inheritDoc}
     */
@Override
@EventListener
public void notifyOfTableRename(@NonNull final MetacatRenameTablePostEvent event) {
    log.debug("Received RenameTableEvent {}", event);
    UpdateTableMessage message = null;
    try {
        message = this.createUpdateTableMessage(UUID.randomUUID().toString(), event.getRequestContext().getTimestamp(), event.getRequestContext().getId(), event.getName().toString(), event.getOldTable(), event.getCurrentTable());
        this.publishNotification(this.tableTopicArn, message);
        this.registry.counter(this.registry.createId(Metrics.CounterSNSNotificationTableRename.name()).withTags(Metrics.statusSuccessMap)).increment();
    } catch (final Exception e) {
        this.handleException(event.getName(), "Unable to publish rename table notification", Metrics.CounterSNSNotificationTableRename.name(), message, e);
    }
}
Also used : UpdateTableMessage(com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTableMessage) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) EventListener(org.springframework.context.event.EventListener)

Example 2 with UpdateTableMessage

use of com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTableMessage in project metacat by Netflix.

the class SNSNotificationServiceImpl method notifyOfTableUpdate.

/**
     * {@inheritDoc}
     */
@Override
@EventListener
public void notifyOfTableUpdate(@NonNull final MetacatUpdateTablePostEvent event) {
    log.debug("Received UpdateTableEvent {}", event);
    UpdateTableMessage message = null;
    try {
        message = this.createUpdateTableMessage(UUID.randomUUID().toString(), event.getRequestContext().getTimestamp(), event.getRequestContext().getId(), event.getName().toString(), event.getOldTable(), event.getCurrentTable());
        this.publishNotification(this.tableTopicArn, message);
        this.registry.counter(this.registry.createId(Metrics.CounterSNSNotificationTableUpdate.name()).withTags(Metrics.statusSuccessMap)).increment();
    } catch (final Exception e) {
        this.handleException(event.getName(), "Unable to publish update table notification", Metrics.CounterSNSNotificationTableUpdate.name(), message, e);
    }
}
Also used : UpdateTableMessage(com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTableMessage) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) EventListener(org.springframework.context.event.EventListener)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 UpdateTableMessage (com.netflix.metacat.common.dto.notifications.sns.messages.UpdateTableMessage)2 IOException (java.io.IOException)2 EventListener (org.springframework.context.event.EventListener)2