org.hyperledger.fabric.overview.html Maven / Gradle / Ivy
Show all versions of fabric-chaincode-shim Show documentation
This is the project to support the writing of Contracts with the JVM runtime - enabling development of using Java language or other JVM based languages
The Fabric programming model is described in the Developing Applications chapter of the Hyperledger Fabric documentation.
All Contracts should implement {@link org.hyperledger.fabric.contract.ContractInterface} interface, in addition to the {@link org.hyperledger.fabric.contract.annotation.Contract} annotation.
Configuration
Some Java chaincode settings are configurable on a per chaincode basis, including the maximum gRPC inbound message size, thread pool settings, and whether to enable chaincode metrics.
The default settings are as follows:
MAX_INBOUND_MESSAGE_SIZE=104857600
CHAINCODE_METRICS_ENABLED=false
TP_CORE_POOL_SIZE=5
TP_MAX_POOL_SIZE=5
TP_QUEUE_SIZE=5000
To override the defaults, a config.props
Java properties file must be included in the default, unnamed, package on your contract code's classpath, which will then be loaded when the chaincode starts.
Setting the metrics enabled flag to true
will turn on default metrics logging. The TP_
values establish the core thread pool size, max thread poolsize, and the number of of tasks that will wait.
Open Telemetry
To use Open Telemetry, set the following properties:
CHAINCODE_METRICS_ENABLED=true
CHAINCODE_METRICS_PROVIDER=org.hyperledger.fabric.metrics.impl.OpenTelemetryMetricsProvider
Additionally, you can set properties after the OpenTelemetry specification.
Example:
OTEL_EXPORTER_OTLP_ENDPOINT=otelcollector:4317
OTEL_EXPORTER_OTLP_INSECURE=true
If you are building your chaincode using Gradle or Maven, create a config.props
file in the src/main/resources
directory and include the settings you want to override.