Function near_lake_framework::streamer

source ·
pub fn streamer(
    config: LakeConfig
) -> (JoinHandle<Result<(), Error>>, Receiver<StreamerMessage>)
Expand description

Creates mpsc::channel and returns the receiver to read the stream of StreamerMessage

use near_lake_framework::LakeConfigBuilder;
use tokio::sync::mpsc;

   let config = LakeConfigBuilder::default()
       .testnet()
       .start_block_height(82422587)
       .build()
       .expect("Failed to build LakeConfig");

    let (_, stream) = near_lake_framework::streamer(config);

    while let Some(streamer_message) = stream.recv().await {
        eprintln!("{:#?}", streamer_message);
    }