Syntax:
com.ibi.agents.XDFabricQueryAgent
Description:
This service invokes chaincode to make a read-only query in the Hyperledger Fabric. It sends a query proposal request to all the configured peers, then it extracts the response payload from the first successful proposal response. The payload is a single ByteString value, but it can also be parsed by the service in XML or JSON, assuming the chaincode produced the result in this format.
Parameters:
The following tables list and describe the parameters for the Hyperledger Fabric Query service.
Main |
|
---|---|
Parameter |
Description |
Fabric Channel Provider |
The name of the configured Hyperledger Fabric Channel provider. |
Chaincode Name |
The name of the chaincode to call. |
Chaincode Path |
The path of the chaincode to call. |
Chaincode Version |
The version of the chaincode to call. |
Return Value Format |
Determines how the ByteString response should be interpreted. |
The service refers to the Fabric Channel Provider by name to gain access to the reconstructed Channel. The chaincode name, path and version are determined when the chaincode is installed. The path is similar to a namespace and is not related to a path in the file system. The chaincode must already be installed before calling the Hyperledger Fabric Query service.
The response is a ByteString value that can be parsed in different ways depending on the Return Value Format parameter. It can be:
Call |
|
---|---|
Parameter |
Description |
Argument Type |
The data type of all the chaincode arguments, either a regular String, or a byte array encoded as a Hex String with two consecutive hexadecimal characters per byte. |
Argument 0 |
The value of the first argument. |
Argument 1 |
The value of the second argument. |
Argument 2 |
The value of the third argument. |
Argument 3 |
The value of the fourth argument. |
Argument 4 |
The value of the fifth argument. |
In the Call group of parameters, the Argument N properties are the arguments to the chaincode invocation. By convention, Argument 0 is often an operation name understood by the chaincode. There can be an unlimited number of arguments. This is done by defining user properties with names of the form argN. For example, the next argument after Argument 4 is arg5. The list of arguments stops at the first empty argument.
The type of the arguments can be string or byte array. All arguments must be the same type. A byte array is encoded as an hexadecimal string with two consecutive hexadecimal characters per byte. For example, 616263 is abc in a UTF8 byte array.
Edges:
The following table lists and describes the edges that are returned by the Hyperledger Fabric Query service.
Edge |
Description |
---|---|
success |
The operation was successful. |
fail_parse |
An iFL expression could not be evaluated. |
fail_operation |
The operation could not be completed successfully. |
Example:
The following example shows the parameter values for an invocation of the chaincode to query the value of b in the End2endIT sample of the Hyperledger Fabric Java SDK. It assumes that the fabric1 provider has the same values as the example shown in Hyperledger Fabric Channel Provider.
Parameter |
Value |
---|---|
Fabric Channel Provider |
fabric1 |
Chaincode Name |
example_cc_go |
Chaincode Path |
github.com/example_cc |
Chaincode Version |
1 |
Return Value Format |
UTF8 String |
Argument Type |
String |
Argument 0 |
query |
Argument 1 |
b |
The same invocation can be achieved with the chaincode arguments encoded as byte arrays. The iFL function _hex(value,charset) might be useful.
Parameter |
Value |
---|---|
Argument Type |
Hex String |
Argument 0 |
_hex('query', 'UTF8') |
Argument 1 |
62 |