Search in sources :

Example 1 with AggregateListener

use of com.kloia.eventapis.view.AggregateListener in project eventapis by kloiasoft.

the class SpringKafkaOpListener method listenOperations.

@Transactional(rollbackFor = Exception.class)
@KafkaListener(id = "op-listener", topics = Operation.OPERATION_EVENTS, containerFactory = "operationsKafkaListenerContainerFactory")
void listenOperations(ConsumerRecord<String, Operation> record) {
    String key = record.key();
    Operation value = record.value();
    log.debug("Incoming Message: " + key + " " + value);
    userContext.extractUserContext(value.getUserContext());
    for (AggregateListener snapshotRecorder : aggregateListeners) {
        snapshotRecorder.listenOperations(record);
    }
}
Also used : Operation(com.kloia.eventapis.pojos.Operation) AggregateListener(com.kloia.eventapis.view.AggregateListener) KafkaListener(org.springframework.kafka.annotation.KafkaListener) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Operation (com.kloia.eventapis.pojos.Operation)1 AggregateListener (com.kloia.eventapis.view.AggregateListener)1 KafkaListener (org.springframework.kafka.annotation.KafkaListener)1 Transactional (org.springframework.transaction.annotation.Transactional)1