Skip to content

Commit b86312c

Browse files
docs(fabricx): add notification service section to platform readme
Add high-level documentation for the finality notification service covering API usage, configuration, current limitations, and a usage example showing how view applications can wait for transaction finality via the ListenerManager. Signed-off-by: Said Altury <Said.Altury@ibm.com>
1 parent d3f2ddd commit b86312c

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

docs/platform/fabric-x/readme.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,40 @@ func main() {
3939

4040
> TODO: Configuration details for Fabric-x platform here soon.
4141
42+
## Notification Service (Transaction Finality)
43+
44+
The notification service delivers realtime transaction finality events to FSC application nodes. It maintains a persistent bidirectional gRPC stream to the [fabric-x-committer](https://github.com/hyperledger/fabric-x-committer)'s `Notifier` service, which pushes notifications as transactions are committed, invalidated, or timed out. The connection to the committer is re-used and shared among all active listeners for a given network and channel.
45+
46+
### API
47+
48+
Obtain a `ListenerManager` via `finality.GetListenerManager(sp, network, channel)`, then use:
49+
50+
- `AddFinalityListener(txID, listener)`: registers a `FinalityListener` whose `OnStatus` callback fires once when the transaction reaches finality. Only the first listener for a given txID triggers a subscription request to the committer; subsequent listeners for the same txID piggyback on it. After dispatch, all listeners for the txID are automatically removed.
51+
- `RemoveFinalityListener(txID, listener)`: unregisters a listener before delivery. Safe to call for unknown txIDs or unregistered listeners.
52+
53+
The `OnStatus` callback receives one of: `fdriver.Valid` (committed), `fdriver.Invalid` (rejected), or `fdriver.Unknown` (undetermined / timeout).
54+
55+
### Limitations
56+
57+
- **No automatic reconnection**: if the stream breaks, the manager is removed and registered listeners are lost. A new manager is created on the next `GetListenerManager` call.
58+
- **Handler timeout**: callbacks that exceed 5 seconds (`DefaultHandlerTimeout`) are abandoned with a warning. Handlers that ignore context cancellation will leak a goroutine but won't block other listeners.
59+
60+
### Configuration
61+
62+
```yaml
63+
notificationService:
64+
endpoints:
65+
- address: "committer.example.com:9090"
66+
connectionTimeout: 30s
67+
tlsEnabled: true
68+
tlsRootCertFile: "/path/to/ca.pem"
69+
requestTimeout: 30s
70+
```
71+
72+
### Usage from a View
73+
Refer to the [Simple integration test](/integration/fabricx/simple) for reference.
74+
75+
4276
## Integration Tests
4377
4478
The integration tests for the Fabric-x platform use the [fabric-x-committer-test-node](https://github.com/hyperledger/fabric-x-committer/pkgs/container/fabric-x-committer-test-node) container image.

0 commit comments

Comments
 (0)