From 9f5a2dd509d6860848392068f249fd41188895e7 Mon Sep 17 00:00:00 2001 From: David Enyeart Date: Fri, 12 Oct 2018 13:52:36 -0400 Subject: [PATCH] [FABN-973] Improve ChannelEventHub doc for node sdk Clarify usage scenarios for channel-based event service. Change-Id: I9a44964b46fda6513e618a01616240f3180663e7 Signed-off-by: David Enyeart --- docs/tutorials/channel-events.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/tutorials/channel-events.md b/docs/tutorials/channel-events.md index b30bc92623..2756e98b46 100644 --- a/docs/tutorials/channel-events.md +++ b/docs/tutorials/channel-events.md @@ -1,9 +1,8 @@ -This tutorial illustrates the use of channel-based events. These events are -similar to the existing events, however are specific to a single channel. -The client handling of channel-based events has a few new options when setting -up a listener. Channel-based events are a new feature of the -Hyperledger Fabric Node.js client as of v1.1. +This tutorial illustrates the use of channel-based events. +Channel-based events are a new feature of the Hyperledger Fabric Node.js client +as of v1.1. It replaces the event hub from v1.0, with a more useful +and reliable interface for applications to receive events. For more information on getting started with Fabric check out [Building your first network](http://hyperledger-fabric.readthedocs.io/en/latest/build_network.html). @@ -22,9 +21,19 @@ transactions or chaincode events. This allows a client application to be notified of transaction completion or arbitrary chaincode events without having to perform multiple queries or search through the blocks as they are received. -The service allows any user to receive "filtered" block events (which contain no -sensitive information, in other words). Receiving "unfiltered" block events -requires read access to the channel. The default behavior is to connect to +Applications may use block or chaincode events to provide channel data to +other applications. For example an application could listen for block events +and write transaction data to a data store for the purpose of performing +queries or other analytics against the channel's data. +For each block received, the block listener application could iterate through +the block transactions, and build a data store using the key/value writes from +each valid transaction's 'rwset' (see the {@link Block} and {@link Transaction} +Type Definitions for details of these data structures). + +The event service also allows applications to receive "filtered" block events +(which allow for receiving transaction validation status without providing +other sensitive information). Access to "filtered" and "unfiltered" events +can be configured independently in Fabric. The default behavior is to connect to receive filtered block events. To connect to receive unfiltered block events call `connect(true)` (see below).