lundi 30 janvier 2017

TPL DataFlow and architecture design

TPL DataFlow library very useful for my application. I have about 10 blocks and I think a count will increase.

When I prepared prototype of my application I was confused because I understood that I got functional design.

    void BIG_WORKFLOW_METHOD(){
    ...
    var block1 = new TransformBlock<string, string>(...);
    var block2 = new TransformBlock<string, string>(...);
    var block3 = new TransformManyBlock<string, string>(...);
    var broadCastBlock = new BroadcastBlock<EventObject>(ev => ev);
    ...
    var block9 = new ActionBlock<string>(...);
    var block10 = new ActionBlock<EventObject>(...);
    block1.LinkTo(block2);
    block2.LinkTo(block3);
    block3.LinkTo(block4);
    broadCastBlock.LinkTo(block5);
    broadCastBlock.LinkTo(block6);
    ...
    }

I need to transform my big-workflow-method to OOP-design. I want to be able to add or remove steps from my workflow in future easy. May be somebody solve that task?

I guess the most appropriate architecture for Workflow is State design pattern, but I think TPL DataFlow already use this pattern and that will be over-architect.

Aucun commentaire:

Enregistrer un commentaire