Skip to content

Commit

Permalink
fix: add message correlation log to record stream
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpuppa committed Jul 17, 2024
1 parent 4dc3edf commit 618269e
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import io.camunda.zeebe.protocol.record.value.JobBatchRecordValue;
import io.camunda.zeebe.protocol.record.value.JobRecordValue;
import io.camunda.zeebe.protocol.record.value.MessageBatchRecordValue;
import io.camunda.zeebe.protocol.record.value.MessageCorrelationRecordValue;
import io.camunda.zeebe.protocol.record.value.MessageRecordValue;
import io.camunda.zeebe.protocol.record.value.MessageStartEventSubscriptionRecordValue;
import io.camunda.zeebe.protocol.record.value.MessageSubscriptionRecordValue;
Expand Down Expand Up @@ -125,6 +126,7 @@ public RecordStreamLogger(final RecordStreamSource recordStreamSource) {
ValueType.PROCESS_INSTANCE_MIGRATION, this::logProcessInstanceMigrationRecordValue);
valueTypeLoggers.put(
ValueType.COMPENSATION_SUBSCRIPTION, this::logCompensationSubscriptionRecordValue);
valueTypeLoggers.put(ValueType.MESSAGE_CORRELATION, this::logMessageCorrelationRecordValue);
}

public void log() {
Expand Down Expand Up @@ -488,6 +490,15 @@ private String logCompensationSubscriptionRecordValue(final Record<?> record) {
return joiner.toString();
}

private String logMessageCorrelationRecordValue(final Record<?> record) {
final MessageCorrelationRecordValue value = (MessageCorrelationRecordValue) record.getValue();
final StringJoiner joiner = new StringJoiner(", ", "", "");
joiner.add(String.format("(Process instance key: %d)", value.getProcessInstanceKey()));
joiner.add(String.format("(Message name: %s)", value.getName()));
joiner.add(String.format("(Message correlation key id: %s)", value.getCorrelationKey()));
return joiner.toString();
}

protected Map<ValueType, Function<Record<?>, String>> getValueTypeLoggers() {
return valueTypeLoggers;
}
Expand Down

0 comments on commit 618269e

Please sign in to comment.