juspay / hyperswitch

An open source payments switch written in Rust to make payments fast, reliable and affordable
https://hyperswitch.io/
Apache License 2.0
11.32k stars 1.22k forks source link

[Refactor] Convert KafkaStore to EventStore #4494

Open lsampras opened 4 months ago

lsampras commented 4 months ago

Currently we have hardcoded KafkaStore as a composite of StorageInterface along with a kafka producer, However we wanna make this more generic by substituting KafkaProducer with a generic MessageInterface

The final structure of EventStore would look like

#[derive(Clone)]
pub struct EventStore<T: StorageInterface, E: MessagingInterface> {
    event_producer: E,
    storage: T,
}

This refactor could be done in 2 parts as follows

  1. Use MessageInterface as a generic trait instead of fixed KafkaProducer
  2. Remove KafkaMessage trait implementations and use MessageInterface instead
rishav-bose0 commented 3 months ago

Hey @lsampras! I would like to help with this issue. Can I work on this?

lsampras commented 3 months ago

Hi @rishav-bose0, since this change is slightly spread out throughout the code base, I'd prefer if we connect on either slack or discord to formulate & plan the approach to solve this...

rishav-bose0 commented 3 months ago

sure, I too had some doubts on the generic replacements. Let's connect on discord.