use of io.camunda.zeebe.protocol.record.intent.MessageStartEventSubscriptionIntent in project zeebe-simple-monitor by camunda-community-hub.
the class MessageSubscriptionImporter method importMessageStartEventSubscription.
public void importMessageStartEventSubscription(final Schema.MessageStartEventSubscriptionRecord record) {
final MessageStartEventSubscriptionIntent intent = MessageStartEventSubscriptionIntent.valueOf(record.getMetadata().getIntent());
final long timestamp = record.getMetadata().getTimestamp();
final MessageSubscriptionEntity entity = messageSubscriptionRepository.findByProcessDefinitionKeyAndMessageName(record.getProcessDefinitionKey(), record.getMessageName()).orElseGet(() -> {
final MessageSubscriptionEntity newEntity = new MessageSubscriptionEntity();
newEntity.setId(// message subscription doesn't have a key - it is always '-1'
generateId());
newEntity.setMessageName(record.getMessageName());
newEntity.setProcessDefinitionKey(record.getProcessDefinitionKey());
newEntity.setTargetFlowNodeId(record.getStartEventId());
return newEntity;
});
entity.setState(intent.name().toLowerCase());
entity.setTimestamp(timestamp);
messageSubscriptionRepository.save(entity);
}
Aggregations