use of io.zeebe.monitor.entity.MessageSubscriptionEntity 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);
}
use of io.zeebe.monitor.entity.MessageSubscriptionEntity 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