I’m listening to the command completion service and trying to understand how to handle the returned result.
Question 1:
In Ledger API, does it use all the grpc status code?
https://developers.google.com/maps-booking/reference/grpc-api/status_codes
Question 2:
Which status code indicates that the transaction has been committed and no need to retry?
e.g. OK, ALREADY_EXISTS …
Below is the code I use to get the status
Disposable t = response.subscribeWith(new DisposableSubscriber<CompletionStreamResponse>(){
@Override
public void onNext(CompletionStreamResponse completionStreamResponse) {
completionStreamResponse.getCompletions()
.forEach(completion -> {
if (completion.getStatus().equals(Status.OK)){
commandSubmissionQueue.remove(completion.getCommandId());
}
logger.info(
"Completion for cid:{}/party:{}/Status:{}/{}",
completion.getCommandId(),
party,
completion.getStatus().getCode(),
Status.fromCodeValue(completion.getStatus().getCode()).getCode().ordinal()
);
});
}