mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-19 16:15:09 +00:00
Use new default call options API in Java off_chain_data sample
Also use hyperlinks for easier navigation to code mentioned in the README. Signed-off-by: Mark S. Lewis <mark_lewis@uk.ibm.com>
This commit is contained in:
parent
8ca50df4ff
commit
adfd850e64
3 changed files with 12 additions and 14 deletions
|
|
@ -17,14 +17,14 @@ This sample uses the block event listening capability of the [Fabric Gateway cli
|
|||
The client application provides several "commands" that can be invoked using the command-line:
|
||||
|
||||
- **getAllAssets**: Retrieve the current details of all assets recorded on the ledger. See:
|
||||
- TypeScript: `application-typescript/src/getAllAssets.ts`
|
||||
- Java: `application-java/app/src/main/java/GetAllAssets.java`
|
||||
- TypeScript: [application-typescript/src/getAllAssets.ts](application-typescript/src/getAllAssets.ts)
|
||||
- Java: [application-java/app/src/main/java/GetAllAssets.java](application-java/app/src/main/java/GetAllAssets.java)
|
||||
- **listen**: Listen for block events, and use them to replicate ledger updates in an off-chain data store. See:
|
||||
- TypeScript: `application-typescript/src/listen.ts`
|
||||
- Java: `application-java/app/src/main/java/Transact.java`
|
||||
- TypeScript: [application-typescript/src/listen.ts](application-typescript/src/listen.ts)
|
||||
- Java: [application-java/app/src/main/java/Transact.java](application-java/app/src/main/java/Transact.java)
|
||||
- **transact**: Submit a set of transactions to create, modify and delete assets. See:
|
||||
- TypeScript: `application-typescript/src/transact.ts`
|
||||
- Java: `application-java/app/src/main/java/Transact.java`
|
||||
- TypeScript: [application-typescript/src/transact.ts](application-typescript/src/transact.ts)
|
||||
- Java: [application-java/app/src/main/java/Transact.java](application-java/app/src/main/java/Transact.java)
|
||||
|
||||
To keep the sample code concise, the **listen** command writes ledger updates to an output file named `store.log` in the current working directory (which for the Java sample is the `application-java/app` directory). A real implementation could write ledger updates directly to an off-chain data store of choice. You can inspect the information captured in this file as you run the sample.
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,8 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
// implementation 'com.google.guava:guava:30.1.1-jre'
|
||||
implementation 'io.grpc:grpc-netty-shaded:1.46.0'
|
||||
implementation 'org.hyperledger.fabric:fabric-gateway:1.0.2-dev-20220518-1'
|
||||
implementation 'org.hyperledger.fabric:fabric-gateway:1.0.2-dev-20220608-5'
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +29,7 @@ java {
|
|||
}
|
||||
|
||||
checkstyle {
|
||||
toolVersion '10.2'
|
||||
toolVersion '10.3'
|
||||
}
|
||||
|
||||
application {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import io.grpc.Channel;
|
|||
import io.grpc.ManagedChannel;
|
||||
import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts;
|
||||
import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder;
|
||||
import org.hyperledger.fabric.client.CallOption;
|
||||
import org.hyperledger.fabric.client.Gateway;
|
||||
import org.hyperledger.fabric.client.identity.Identities;
|
||||
import org.hyperledger.fabric.client.identity.Identity;
|
||||
|
|
@ -92,10 +91,10 @@ public final class Connections {
|
|||
.identity(newIdentity())
|
||||
.signer(newSigner())
|
||||
.connection(grpcChannel)
|
||||
.evaluateOptions(CallOption.deadlineAfter(EVALUATE_TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
.endorseOptions(CallOption.deadlineAfter(ENDORSE_TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
.submitOptions(CallOption.deadlineAfter(SUBMIT_TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
.commitStatusOptions(CallOption.deadlineAfter(COMMIT_STATUS_TIMEOUT_SECONDS, TimeUnit.SECONDS));
|
||||
.evaluateOptions(options -> options.withDeadlineAfter(EVALUATE_TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
.endorseOptions(options -> options.withDeadlineAfter(ENDORSE_TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
.submitOptions(options -> options.withDeadlineAfter(SUBMIT_TIMEOUT_SECONDS, TimeUnit.SECONDS))
|
||||
.commitStatusOptions(options -> options.withDeadlineAfter(COMMIT_STATUS_TIMEOUT_SECONDS, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
private static Identity newIdentity() throws IOException, CertificateException {
|
||||
|
|
|
|||
Loading…
Reference in a new issue