use of io.camunda.zeebe.protocol.record.intent.MessageIntent in project zeebe-simple-monitor by camunda-community-hub.
the class MessageImporter method importMessage.
public void importMessage(final Schema.MessageRecord record) {
final MessageIntent intent = MessageIntent.valueOf(record.getMetadata().getIntent());
final long key = record.getMetadata().getKey();
final long timestamp = record.getMetadata().getTimestamp();
final MessageEntity entity = messageRepository.findById(key).orElseGet(() -> {
final MessageEntity newEntity = new MessageEntity();
newEntity.setKey(key);
newEntity.setName(record.getName());
newEntity.setCorrelationKey(record.getCorrelationKey());
newEntity.setMessageId(record.getMessageId());
newEntity.setPayload(record.getVariables().toString());
return newEntity;
});
entity.setState(intent.name().toLowerCase());
entity.setTimestamp(timestamp);
messageRepository.save(entity);
}
Aggregations