-
Notifications
You must be signed in to change notification settings - Fork 0
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: let consumeRun throw to let message broker handle failures #91
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Joris Mancini <[email protected]>
ed6c931
to
dfa0f28
Compare
Signed-off-by: Joris Mancini <[email protected]>
* @author Joris Mancini <joris.mancini_externe at rte-france.com> | ||
*/ | ||
public class ComputationException extends RuntimeException { | ||
public ComputationException(String message, Throwable cause) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably better to add the constructor without cause right now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
isCanceled = future.cancel(true); // cancel computation in progress | ||
if (isCanceled) { | ||
if (future == null) { | ||
cleanResultsAndPublishCancel(cancelContext.resultUuid(), cancelContext.receiver()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will be run on all but one server who is doing the computation ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like it's already the case after this method returns...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before we did publishCancelFail but now we do cleanResults and publishStop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
cleanResultsAndPublishCancel(cancelContext.resultUuid(), cancelContext.receiver()); | ||
} else { | ||
boolean isCanceled = future.cancel(true); // cancel computation in progress | ||
if (future.isDone() || isCanceled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about adding this clean when the computation is done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
Signed-off-by: Joris Mancini <[email protected]>
} catch (InterruptedException e) { | ||
Thread.currentThread().interrupt(); | ||
} catch (CancellationException e) { | ||
LOGGER.info("Computation was interrupted"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to add context (resultUuid) to this log just like above it ?
Signed-off-by: Joris Mancini <[email protected]>
Quality Gate failedFailed conditions |
Please check if the PR fulfills these requirements
What kind of change does this PR introduce?
Change behavior of computation consumer to let it throw so that message broker can handle failures
Does this PR introduce a breaking change or deprecate an API?