use of com.kloia.eventapis.pojos.Operation in project eventapis by kloiasoft.
the class KafkaOperationRepository method successOperation.
@Override
public void successOperation(String eventId, SerializableConsumer<Event> action) {
Operation operation = new Operation();
operation.setSender(senderGroupId);
operation.setAggregateId(eventId);
operation.setTransactionState(TransactionState.TXN_SUCCEEDED);
operation.setUserContext(userContext.getUserContext());
operation.setContext(operationContext.getContext());
operation.setOpDate(System.currentTimeMillis());
log.debug("Publishing Operation:" + operation.toString());
operationsKafka.send(new ProducerRecord<>(Operation.OPERATION_EVENTS, operationContext.getContext().getOpId(), operation));
}
use of com.kloia.eventapis.pojos.Operation in project eventapis by kloiasoft.
the class KafkaOperationRepositoryFactory method createKafkaOperationRepository.
public KafkaOperationRepository createKafkaOperationRepository(ObjectMapper objectMapper) {
KafkaProducer<String, Operation> operationsKafka = new KafkaProducer<>(kafkaProperties.buildProducerProperties(), new StringSerializer(), new JsonSerializer<>(objectMapper));
KafkaProducer<String, PublishedEventWrapper> eventsKafka = new KafkaProducer<>(kafkaProperties.buildProducerProperties(), new StringSerializer(), new JsonSerializer<>(objectMapper));
return new KafkaOperationRepository(operationContext, userContext, operationsKafka, eventsKafka, kafkaProperties.getConsumer().getGroupId());
}
Aggregations