use of com.netflix.metacat.common.MetacatRequestContext in project metacat by Netflix.
the class MetacatElasticSearchEventHandlers method metacatSaveTablePartitionPostEventHandler.
/**
* Subscriber.
*
* @param event event
*/
@EventListener
public void metacatSaveTablePartitionPostEventHandler(final MetacatSaveTablePartitionPostEvent event) {
log.debug("Received SaveTablePartitionEvent {}", event);
registry.counter(Metrics.CounterElasticSearchPartitionSave.name()).increment();
final List<PartitionDto> partitionDtos = event.getPartitions();
final MetacatRequestContext context = event.getRequestContext();
final List<ElasticSearchDoc> docs = partitionDtos.stream().map(dto -> new ElasticSearchDoc(dto.getName().toString(), dto, context.getUserName(), false)).collect(Collectors.toList());
es.save(ElasticSearchDoc.Type.partition.name(), docs);
}
Aggregations