Search in sources :

Example 1 with MessageStartEventSubscriptionIntent

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);
}
Also used : MessageStartEventSubscriptionIntent(io.camunda.zeebe.protocol.record.intent.MessageStartEventSubscriptionIntent) MessageSubscriptionEntity(io.zeebe.monitor.entity.MessageSubscriptionEntity)

Aggregations

MessageStartEventSubscriptionIntent (io.camunda.zeebe.protocol.record.intent.MessageStartEventSubscriptionIntent)1 MessageSubscriptionEntity (io.zeebe.monitor.entity.MessageSubscriptionEntity)1