NEAR Event Stream Processor

Usage

```toml [dependencies] near-event-stream-processor = "0.0.1"

```

```rust

[derive(Deserialize, Debug)]

pub struct EmitInfo { pub receiptid: String, pub blocktimestamp: u64, pub blockheight: u64, pub shardid: u64, pub contractaccountid: String, }

[derive(Deserialize, Debug)]

pub struct GenericEvent { pub standard: String, pub version: String, pub event: String, pub data: serdejson::Value, pub emitinfo: Option, }

[tokio::main]

async fn main() -> anyhow::Result<()> { let mut kafkaconfig: HashMap = HashMap::new(); kafkaconfig.insert( "bootstrap.servers".tostring(), "localhost:29092".tostring(), );

let streamer_config = StreamerConfigBuilder::default()
    .kafka_config(kafka_config)
    .group_id("example-group".to_string())
    .auto_offset_reset("earliest".to_string())
    .topics(vec!["localnet.events.all".to_string()])
    .build()?;

let (_, mut stream) = streamer(&streamer_config)?;

while let Some(streamer_message) = stream.recv().await {
    let event = streamer_message.event::<GenericEvent>();
    match event {
        Ok(event) => println!("Received event: {:?}", event),
        Err(err) => println!("Error: {:?}", err),
    }
    streamer_message.commit().await?;
}

Ok(())

} ```