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] Expression Parsing and Failure in AbstractConsumer #14753

Merged
merged 1 commit into from
Jan 17, 2024
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 @@ -273,37 +273,42 @@ public List<ChangeEvent> pollEvents(long offset, long batchSize) {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
// Must Have , Before Execute the Init, Quartz Requires a Non-Arg Constructor
this.init(jobExecutionContext);

// Poll Events from Change Event Table
List<ChangeEvent> batch = pollEvents(offset, 100);
int batchSize = batch.size();

// Retry Failed Events
Set<FailedEvent> failedEventsList =
JsonUtils.convertValue(
jobDetail.getJobDataMap().get(FAILED_EVENT_EXTENSION), new TypeReference<>() {});
if (failedEventsList != null) {
List<ChangeEvent> failedChangeEvents =
failedEventsList.stream()
.filter(failedEvent -> failedEvent.getRetriesLeft() > 0)
.map(FailedEvent::getChangeEvent)
.toList();
batch.addAll(failedChangeEvents);
}
try {

if (!batch.isEmpty()) {
// Publish Events
alertMetrics.withTotalEvents(alertMetrics.getTotalEvents() + batch.size());
publishEvents(batch);
this.init(jobExecutionContext);

// Commit the Offset
offset += batchSize;
commit(jobExecutionContext);
}
// Poll Events from Change Event Table
List<ChangeEvent> batch = pollEvents(offset, 100);
int batchSize = batch.size();

// Retry Failed Events
Set<FailedEvent> failedEventsList =
JsonUtils.convertValue(
jobDetail.getJobDataMap().get(FAILED_EVENT_EXTENSION), new TypeReference<>() {});
if (failedEventsList != null) {
List<ChangeEvent> failedChangeEvents =
failedEventsList.stream()
.filter(failedEvent -> failedEvent.getRetriesLeft() > 0)
.map(FailedEvent::getChangeEvent)
.toList();
batch.addAll(failedChangeEvents);
}

if (!batch.isEmpty()) {
// Publish Events
alertMetrics.withTotalEvents(alertMetrics.getTotalEvents() + batch.size());
publishEvents(batch);

// Call stop to close the client
this.stop();
// Commit the Offset
offset += batchSize;
commit(jobExecutionContext);
}
} catch (Exception e) {
LOG.error("Error in executing the Job : {} ", e.getMessage());
} finally {
// Call stop to close the client
this.stop();
}
}

public EventSubscription getEventSubscription() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ const AddAlertPage = () => {

const requestFilteringRules = filteringRules?.rules?.map((curr) => ({
...curr,
condition: `${curr.name}(${map(
condition: `${curr.name}({${map(
curr.condition,
(v: string) => `'${v}'`
)?.join(', ')})`,
)?.join(', ')}})`,
}));

try {
Expand Down
Loading