use of org.springframework.context.event.EventListener in project cas by apereo.
the class DefaultCasEventListener method handleCasAuthenticationPolicyFailureEvent.
/**
* Handle cas authentication policy failure event.
*
* @param event the event
*/
@EventListener
public void handleCasAuthenticationPolicyFailureEvent(final CasAuthenticationPolicyFailureEvent event) {
if (this.casEventRepository != null) {
final CasEvent dto = prepareCasEvent(event);
dto.setPrincipalId(event.getAuthentication().getPrincipal().getId());
dto.putId(CasAuthenticationPolicyFailureEvent.class.getSimpleName());
this.casEventRepository.save(dto);
}
}
use of org.springframework.context.event.EventListener in project cas by apereo.
the class DefaultCasEventListener method handleCasTicketGrantingTicketCreatedEvent.
/**
* Handle TGT creation event.
*
* @param event the event
*/
@EventListener
public void handleCasTicketGrantingTicketCreatedEvent(final CasTicketGrantingTicketCreatedEvent event) {
if (this.casEventRepository != null) {
final CasEvent dto = prepareCasEvent(event);
dto.setCreationTime(event.getTicketGrantingTicket().getCreationTime().toString());
dto.putId(TicketIdSanitizationUtils.sanitize(event.getTicketGrantingTicket().getId()));
dto.setPrincipalId(event.getTicketGrantingTicket().getAuthentication().getPrincipal().getId());
this.casEventRepository.save(dto);
}
}
use of org.springframework.context.event.EventListener in project metacat by Netflix.
the class SNSNotificationServiceImpl method notifyOfTableRename.
/**
* {@inheritDoc}
*/
@Override
@EventListener
public void notifyOfTableRename(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, event.getName(), "Unable to publish rename table notification", Metrics.CounterSNSNotificationTableRename.getMetricName(), true);
} catch (final Exception e) {
this.notificationMetric.handleException(event.getName(), "Unable to create json patch for rename table notification", Metrics.CounterSNSNotificationTableRename.getMetricName(), message, e);
}
}
use of org.springframework.context.event.EventListener in project metacat by Netflix.
the class SNSNotificationServiceImpl method notifyOfPartitionAddition.
/**
* {@inheritDoc}
*/
@Override
@EventListener
public void notifyOfPartitionAddition(final MetacatSaveTablePartitionPostEvent event) {
log.debug("Received SaveTablePartitionPostEvent {}", event);
final String name = event.getName().toString();
final long timestamp = event.getRequestContext().getTimestamp();
final String requestId = event.getRequestContext().getId();
// Publish a global message stating how many partitions were updated for the table to the table topic
final TablePartitionsUpdatePayload partitionsUpdatePayload;
if (this.config.isSnsNotificationAttachPartitionIdsEnabled() && event.getPartitions() != null) {
partitionsUpdatePayload = createTablePartitionsUpdatePayload(event.getPartitions(), event, false);
} else {
partitionsUpdatePayload = new TablePartitionsUpdatePayload(event.getPartitions().size(), 0, Lists.newArrayList(), Lists.newArrayList(), PARTITION_ID_UNENABLED);
}
final UpdateTablePartitionsMessage tableMessage = new UpdateTablePartitionsMessage(UUID.randomUUID().toString(), timestamp, requestId, name, partitionsUpdatePayload);
this.publishNotification(this.tableTopicArn, tableMessage, event.getName(), "Unable to publish table partition add notification", Metrics.CounterSNSNotificationTablePartitionAdd.getMetricName(), true);
if (config.isSnsNotificationTopicPartitionEnabled()) {
AddPartitionMessage message = null;
for (final PartitionDto partition : event.getPartitions()) {
message = new AddPartitionMessage(UUID.randomUUID().toString(), timestamp, requestId, name, partition);
this.publishNotification(this.partitionTopicArn, message, event.getName(), "Unable to publish partition creation notification", Metrics.CounterSNSNotificationPartitionAdd.getMetricName(), true);
log.debug("Published create partition message {} on {}", message, this.partitionTopicArn);
}
}
}
use of org.springframework.context.event.EventListener in project metacat by Netflix.
the class SNSNotificationServiceImpl method notifyOfTableCreation.
/**
* {@inheritDoc}
*/
@Override
@EventListener
public void notifyOfTableCreation(final MetacatCreateTablePostEvent event) {
log.debug("Received CreateTableEvent {}", event);
final CreateTableMessage message = new CreateTableMessage(UUID.randomUUID().toString(), event.getRequestContext().getTimestamp(), event.getRequestContext().getId(), event.getName().toString(), event.getTable());
this.publishNotification(this.tableTopicArn, message, event.getName(), "Unable to publish create table notification", Metrics.CounterSNSNotificationTableCreate.getMetricName(), true);
}
Aggregations