use of io.camunda.zeebe.protocol.record.intent.MessageSubscriptionIntent in project zeebe-simple-monitor by camunda-community-hub.
the class MessageSubscriptionImporter method importMessageSubscription.
public void importMessageSubscription(final Schema.MessageSubscriptionRecord record) {
final MessageSubscriptionIntent intent = MessageSubscriptionIntent.valueOf(record.getMetadata().getIntent());
final long timestamp = record.getMetadata().getTimestamp();
final MessageSubscriptionEntity entity = messageSubscriptionRepository.findByElementInstanceKeyAndMessageName(record.getElementInstanceKey(), record.getMessageName()).orElseGet(() -> {
final MessageSubscriptionEntity newEntity = new MessageSubscriptionEntity();
newEntity.setId(// message subscription doesn't have a key - it is always '-1'
generateId());
newEntity.setElementInstanceKey(record.getElementInstanceKey());
newEntity.setMessageName(record.getMessageName());
newEntity.setCorrelationKey(record.getCorrelationKey());
newEntity.setProcessInstanceKey(record.getProcessInstanceKey());
return newEntity;
});
entity.setState(intent.name().toLowerCase());
entity.setTimestamp(timestamp);
messageSubscriptionRepository.save(entity);
}
Aggregations