github.com/true-sqn/fabric@v2.1.1+incompatible/docs/source/peer_event_services.rst (about)

     1  Peer channel-based event services
     2  =================================
     3  
     4  General overview
     5  ----------------
     6  
     7  In previous versions of Fabric, the peer event service was known as the event
     8  hub. This service sent events any time a new block was added to the peer's
     9  ledger, regardless of the channel to which that block pertained, and it was only
    10  accessible to members of the organization running the eventing peer (i.e., the
    11  one being connected to for events).
    12  
    13  Starting with v1.1, there are new services which provide events. These services use an
    14  entirely different design to provide events on a per-channel basis. This means
    15  that registration for events occurs at the level of the channel instead of the peer,
    16  allowing for fine-grained control over access to the peer's data. Requests to
    17  receive events are accepted from identities outside of the peer's organization (as
    18  defined by the channel configuration). This also provides greater reliability and a
    19  way to receive events that may have been missed (whether due to a connectivity issue
    20  or because the peer is joining a network that has already been running).
    21  
    22  Available services
    23  ------------------
    24  
    25  * ``Deliver``
    26  
    27  This service sends entire blocks that have been committed to the ledger. If
    28  any events were set by a chaincode, these can be found within the
    29  ``ChaincodeActionPayload`` of the block.
    30  
    31  * ``DeliverWithPrivateData``
    32  
    33  This service sends the same data as the ``Deliver`` service, and additionally
    34  includes any private data from collections that the client's organization is
    35  authorized to access.
    36  
    37  * ``DeliverFiltered``
    38  
    39  This service sends "filtered" blocks, minimal sets of information about blocks
    40  that have been committed to the ledger. It is intended to be used in a network
    41  where owners of the peers wish for external clients to primarily receive
    42  information about their transactions and the status of those transactions. If
    43  any events were set by a chaincode, these can be found within the
    44  ``FilteredChaincodeAction`` of the filtered block.
    45  
    46  .. note:: The payload of chaincode events will not be included in filtered blocks.
    47  
    48  How to register for events
    49  --------------------------
    50  
    51  Registration for events is done by sending an envelope
    52  containing a deliver seek info message to the peer that contains the desired start
    53  and stop positions, the seek behavior (block until ready or fail if not ready).
    54  There are helper variables ``SeekOldest`` and ``SeekNewest`` that can be used to
    55  indicate the oldest (i.e. first) block or the newest (i.e. last) block on the ledger.
    56  To have the services send events indefinitely, the ``SeekInfo`` message should
    57  include a stop position of ``MAXINT64``.
    58  
    59  .. note:: If mutual TLS is enabled on the peer, the TLS certificate hash must be
    60            set in the envelope's channel header.
    61  
    62  By default, the event services use the Channel Readers policy to determine whether
    63  to authorize requesting clients for events.
    64  
    65  Overview of deliver response messages
    66  -------------------------------------
    67  
    68  The event services send back ``DeliverResponse`` messages.
    69  
    70  Each message contains one of the following:
    71  
    72   * status -- HTTP status code. Each of the services will return the appropriate failure
    73     code if any failure occurs; otherwise, it will return ``200 - SUCCESS`` once
    74     the service has completed sending all information requested by the ``SeekInfo``
    75     message.
    76   * block -- returned only by the ``Deliver`` service.
    77   * block and private data -- returned only by the ``DeliverWithPrivateData`` service.
    78   * filtered block -- returned only by the ``DeliverFiltered`` service.
    79  
    80  A filtered block contains:
    81  
    82   * channel ID.
    83   * number (i.e. the block number).
    84   * array of filtered transactions.
    85   * transaction ID.
    86  
    87     * type (e.g. ``ENDORSER_TRANSACTION``, ``CONFIG``).
    88     * transaction validation code.
    89  
    90   * filtered transaction actions.
    91       * array of filtered chaincode actions.
    92          * chaincode event for the transaction (with the payload nilled out).
    93  
    94  SDK event documentation
    95  -----------------------
    96  
    97  For further details on using the event services, refer to the `SDK documentation. <https://hyperledger.github.io/fabric-sdk-node/{BRANCH}/tutorial-channel-events.html>`_
    98  
    99  .. Licensed under Creative Commons Attribution 4.0 International License
   100      https://creativecommons.org/licenses/by/4.0/