Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Stream Manager #2

Open
kkharji opened this issue Apr 2, 2023 · 0 comments
Open

Multi Stream Manager #2

kkharji opened this issue Apr 2, 2023 · 0 comments

Comments

@kkharji
Copy link
Owner

kkharji commented Apr 2, 2023

Goal

Enable library users to define event schema, consume them in parallel using an easy interface.

Draft

#[derive(RedisTransportValue)]
pub enum RoomServiceKind {
    Clean,
    ExtraTowels,
    ExtraPillows,
    FoodOrder,
}
/// Define stream model for room service
#[derive(StreamModel)]
#[redis(key = "room-service")]
pub struct RoomServiceStream {
    status: String,
    room: usize,
    kind: RoomServiceKind,
}

/// Define stream model for FrontOffice events
#[derive(StreamModel)
pub enum FrontOfficeStream {
	GuestCheckIn {
		guest_name: String,
		room_number: u32,
	}
}

/// Redis Stream Provider, items must derive steam model
#[derive(RedisEventProvider)
pub enum Event {
	RoomService(RoomServiceStream),
	FrontOffice(FrontOfficeStream)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant