Writing Redux Middleware with Effect.ts

Hi everyone. I'm starting to play with Effect.ts and currently thinking of writing a Redux Middleware with it. Where I think I'm running into issues now is that I want to have a background process running being fed by a stream. However I need to get data into that stream from outside the Effect runtime (I think I'm new to this)
const middleware: Middleware = (api: MiddewareApi) => {
    // create a queue
    // create a stream from the queue
    // start a background process that reads from the stream
    return (next) => (action) => {
        try {
            // call the next middleware in the chain
            return next(action);
        } finally {
            // offer the action to the queue
        }
    }
}
Was this page helpful?