Skip to content

Commit

Permalink
Fix propogation of validation events when running Validator with Pub/…
Browse files Browse the repository at this point in the history
…Sub (#926)
  • Loading branch information
noursaidi authored Jul 10, 2024
1 parent efe1e47 commit 7a3bff2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ protected void defaultHandler(Object message) {
Object payload = extractMessagePayload(objectMap);
Envelope envelope = extractMessageEnvelope(objectMap);
requireNull(envelope.payload, "payload not extracted from message envelope");
checkState(reflect.deviceId.equals(envelope.deviceRegistryId),
format("envelope %s/%s registryId %s does not match expected reflector deviceId %s",
envelope.subType, envelope.subFolder, envelope.deviceRegistryId, reflect.deviceId));
// If the message came from a reflector device, check the registry ID matches
// the device ID
if (reflect.deviceId != null) {
checkState(reflect.deviceId.equals(envelope.deviceRegistryId),
format("envelope %s/%s registryId %s does not match expected reflector deviceId %s",
envelope.subType, envelope.subFolder, envelope.deviceRegistryId,
reflect.deviceId));
}

reflect.transactionId = firstNonNull(envelope.transactionId, reflect.transactionId,
ReflectProcessor::makeTransactionId);
processReflection(reflect, envelope, payload);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class Validator {
private static final long REPORT_INTERVAL_SEC = 15;
private static final String EXCLUDE_DEVICE_PREFIX = "_";
private static final String VALIDATION_REPORT_DEVICE = "_validator";
private static final String VALIDATION_EVENT_TOPIC = "validation/event";
private static final String VALIDATION_EVENT_TOPIC = "validation/events";
private static final String VALIDATION_STATE_TOPIC = "validation/state";
private static final String POINTSET_SUBFOLDER = "pointset";
private static final Date START_TIME = new Date();
Expand Down

0 comments on commit 7a3bff2

Please sign in to comment.