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

feat(config): add configuration to reprocess UI sourced events #9988

Merged
Merged
Show file tree
Hide file tree
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,32 +29,37 @@
})
public class UpdateIndicesHook implements MetadataChangeLogHook {

protected final UpdateIndicesService _updateIndicesService;
private final boolean _isEnabled;
protected final UpdateIndicesService updateIndicesService;
private final boolean isEnabled;
private final boolean reprocessUIEvents;

public UpdateIndicesHook(
UpdateIndicesService updateIndicesService,
@Nonnull @Value("${updateIndices.enabled:true}") Boolean isEnabled) {
_updateIndicesService = updateIndicesService;
_isEnabled = isEnabled;
@Nonnull @Value("${updateIndices.enabled:true}") Boolean isEnabled,
@Nonnull @Value("${featureFlags.preProcessHooks.reprocessEnabled:false}")
Boolean reprocessUIEvents) {
this.updateIndicesService = updateIndicesService;
this.isEnabled = isEnabled;
this.reprocessUIEvents = reprocessUIEvents;
}

@Override
public boolean isEnabled() {
return _isEnabled;
return isEnabled;
}

@Override
public void invoke(@Nonnull final MetadataChangeLog event) {
if (event.getSystemMetadata() != null) {
if (event.getSystemMetadata().getProperties() != null) {
if (UI_SOURCE.equals(event.getSystemMetadata().getProperties().get(APP_SOURCE))) {
if (UI_SOURCE.equals(event.getSystemMetadata().getProperties().get(APP_SOURCE))
&& !reprocessUIEvents) {
// If coming from the UI, we pre-process the Update Indices hook as a fast path to avoid
// Kafka lag
return;
}
}
}
_updateIndicesService.handleChangeEvent(event);
updateIndicesService.handleChangeEvent(event);
}
}
Loading
Loading