Crates.io | spring-stream |
lib.rs | spring-stream |
version | 0.2.1 |
source | src |
created_at | 2024-09-03 10:36:44.458044 |
updated_at | 2024-10-06 10:10:36.057556 |
description | rust microservice framework |
homepage | |
repository | https://github.com/holmofy/spring-rs |
max_upload_size | |
id | 1361551 |
size | 52,119 |
spring-stream = { version = "0.1.1", features=["file"] }
spring-stream supports four message storages: file
, stdio
, redis
, and kafka
.
[stream]
uri = "file://./stream" # StreamerUri data stream address
StreamUri supports file, stdio, redis, and kafka. For the format of uri, please refer to StreamerUri.
# File stream configuration
[stream.file]
connect = { create_file = "CreateIfNotExists" }
# Standard stream configuration
[stream.stdio]
connect = { loopback = false }
# Redis stream configuration
[stream.redis]
connect = { db=0,username="user",password="passwd" }
# Kafka stream configuration
[stream.kafka]
connect = { sasl_options={mechanism="Plain",username="user",password="passwd"}}
StreamPlugin
registers a Producer
for sending messages. If you need to send messages in json format, you need to add the json
feature in the dependencies:
spring-stream = { version = "0.1.1", features=["file","json"] }
{{ include_code(path="../../examples/stream-file-example/src/bin/producer.rs") }}
spring-stream
provides a process macro called stream_listener
to subscribe to messages from a specified topic. The code is as follows:
{{ include_code(path="../../examples/stream-file-example/src/bin/consumer.rs") }}
View the complete example code stream-file-example, stream-redis-example, stream-kafka-example