Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add message correlation log to record stream #1205

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading