@Override protected void processNotification(ProgramScheduleStoreDataset scheduleStore, JobQueueDataset jobQueue, Notification notification) { String datasetIdString = notification.getProperties().get(Notification.DATASET_ID); if (datasetIdString == null) { return; } DatasetId datasetId = DatasetId.fromString(datasetIdString); for (ProgramScheduleRecord schedule : scheduleStore.findSchedules(Schedulers.triggerKeyForPartition(datasetId))) { jobQueue.addNotification(schedule, notification); } } }
@Override protected void processNotification(ProgramScheduleStoreDataset scheduleStore, JobQueueDataset jobQueue, Notification notification) { String datasetIdString = notification.getProperties().get(Notification.DATASET_ID); if (datasetIdString == null) { return; } DatasetId datasetId = DatasetId.fromString(datasetIdString); for (ProgramScheduleRecord schedule : scheduleStore.findSchedules(Schedulers.triggerKeyForPartition(datasetId))) { jobQueue.addNotification(schedule, notification); } } }
/** * Verifies the data notification matches with the expected properties. * * @param notification the {@link Notification} to verify * @param expectedDatasetId the expected {@link DatasetId} in the notification * @param expectedKeys if not {@code null}, the expected list of {@link PartitionKey} in the notification */ protected void verifyDataNotification(Notification notification, DatasetId expectedDatasetId, @Nullable Collection<? extends PartitionKey> expectedKeys) { Assert.assertEquals(Notification.Type.PARTITION, notification.getNotificationType()); String id = notification.getProperties().get("datasetId"); Assert.assertNotNull("Missing datasetId in notification property", id); String partitionKeys = notification.getProperties().get("partitionKeys"); Assert.assertNotNull("Missing partitionKeys in notification property", partitionKeys); Assert.assertEquals(expectedDatasetId, DatasetId.fromString(id)); if (expectedKeys != null) { Assert.assertEquals(expectedKeys, GSON.fromJson(partitionKeys, new TypeToken<List<PartitionKey>>() { }.getType())); } } }