Using Raw Agent Methods

Another option to invoke QUERY and UPDATE canister methods from Java is to use raw Agent methods queryRaw and updateRaw.

CompletableFuture<byte[]> response = agent
    .queryRaw(Principal.fromString(canisterId),
        Principal.fromString(effectiveCanisterId),
         "echoInt",
          payload,
          ingressExpiryDatetime);
CompletableFuture<byte[]> response = agent
    .updateRaw(Principal.fromString(canisterId),
        Principal.fromString(effectiveCanisterId),
         "greetjav",
          payload,
          ingressExpiryDatetime);

To get the status of the Internet Computer, use status Agent method. It will return the Status Java type as follows.

Status status = agent.status().get();

Last updated