Hi there,
After reaching to a point in the code where i managed to find a given contract, when trying to submit an “Archive” choice i get the below exception:
Caused by: io.grpc.StatusRuntimeException: NOT_FOUND: CONTRACT_NOT_FOUND(11,0825c84e): Contract could not be found with id 0054ff9fd1c537ece135de287c8fa14ff169ec9d6e16796ff7fe40562b6fb5d441
I know for certain that i managed to find this contract since i printed its package’s details and also debugged it.
Description of The flow:
processTransaction gets as a parameter the Transaction object from the Observer (Flowable client) and for each of its contained events we call processEvent which returns List of Commands (exerciseCommands var) that we try to submit but we fail
private void processTransaction(Transaction tx) {
List<Event> exerciseEvents = tx.getEvents();
List<Command> exerciseCommands =
exerciseEvents.stream()
.filter(e -> e instanceof CreatedEvent)
.map(e -> (CreatedEvent) e)
.flatMap(e -> processEvent(tx.getWorkflowId(), e))
.collect(Collectors.toList());
if (!exerciseCommands.isEmpty()) {
client.getCommandClient().submitAndWait( // <--- This line throws the Exception
tx.getWorkflowId(), APPLICATION_ID, UUID.randomUUID().toString(), tpaPartyId, exerciseCommands)
.blockingGet();
}
}
private Stream<Command> processEvent(String workflowId, CreatedEvent event) {
Identifier template = event.getTemplateId();
boolean isPolicyPagesNotification = template.equals(policyPagesNotificationIdentifier);
if (!isPolicyPagesNotification) {
return Stream.empty();
}
else {
System.out.println("Found module " + policyPagesNotificationIdentifier.toString() + " !!");
PolicyPagesNotification.Contract contract = PolicyPagesNotification.Contract.fromCreatedEvent(event);
// assemble the Archive command
Command cmd = new ExerciseCommand(
template,
event.getContractId(),
"Archive",
new DamlRecord(Collections.emptyList()));
return Stream.of(cmd);
}
}