Skip to content

Reusable eventhandler pipeline #10

@StevenBlair123

Description

@StevenBlair123

At the time fo this Issue being raised, the eventhandler piepline function (handleEvents) looks like this:

    let handleEvents (events:Event seq) = 
        let _ = 
            events
            |> Seq.filter (fun e -> isValidEvent e.EventType)  
            |> Seq.map (fun e -> 
                            Logger.writeline $"Processing {e.EventType}" //Only log out the events we are interested in
                            e)
            |> Seq.map (fun e -> DomainEventFactory.CreateDomainEvent e.Payload e.EventType)
            |> Seq.map loadState 
            |> Seq.map handleEvent                          
            |> Seq.map saveState  
            |> Seq.map postProcessing
            |> Seq.iter (fun _ -> () ) //enumerate pipeline
        ()

What I am wondering is, when we introduced more states, can we somehow reuse this pipeline.
Could loadState and saveState work on a generic?
could handleEvent be passed into handleEvents?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions