github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/docs/source/app_developers_guide/event_subscriptions.rst (about)

     1  *********************
     2  Subscribing to Events
     3  *********************
     4  
     5  As blocks are committed to the blockchain, an application developer may want to
     6  receive information on events such as the creation of a new block or switching
     7  to a new fork. This includes application-specific events that are defined by a
     8  custom transaction family.
     9  
    10  Hyperledger Sawtooth supports creating and broadcasting events. Event
    11  subscription allows an application to perform the following functions:
    12  
    13  * Subscribe to events that occur related to the blockchain
    14  
    15  * Communicate information about transaction execution back to clients without
    16    storing that data in state
    17  
    18  * Perform event catch-up to gather information about state changes from a
    19    specific point on the blockchain
    20  
    21  An application can react immediately to each event or store event data for
    22  later processing and analysis. For example, a `state delta processor` could
    23  store state data in a reporting database for analysis and processing, which
    24  provides access to state information without the delay of requesting state data
    25  from the validator. For examples, see the `Sawtooth Supply Chain
    26  <https://github.com/hyperledger/sawtooth-supply-chain>`_
    27  or `Sawtooth Marketplace <https://github.com/hyperledger/sawtooth-marketplace>`_
    28  repository.
    29  
    30  This section describes the structure of events and event subscriptions, then
    31  explains how to use the validator's `ZeroMQ <http://zeromq.org>`_ messaging
    32  protocol (also called ZMQ or 0MQ) to subscribe to events.
    33  
    34  .. note::
    35  
    36     Web applications can also subscribe to events with a web socket connection to
    37     the REST API, but there are several limitations for this method. For more
    38     information, see :doc:`web_socket_event_subscription`.
    39  
    40  
    41  .. toctree::
    42     :maxdepth: 2
    43  
    44     about_events.rst
    45     about_event_subscriptions.rst
    46     zmq_event_subscription.rst
    47     web_socket_event_subscription.rst
    48  
    49  
    50  .. Licensed under Creative Commons Attribution 4.0 International License
    51  .. https://creativecommons.org/licenses/by/4.0/