twilson63 / palmettoflow

MIT License
14 stars 2 forks source link

PalmettoFlow 2.0 #13

Open twilson63 opened 8 years ago

twilson63 commented 8 years ago

Proposal

I would like to propose a 2.0 version of palmetto flow that enables you to send batch of event messages in a single request. Which will all run and respond back as a batch of event message responses.

The idea is taken from GraphQL, but with palmetto flow it would be a lot less boiler plate code on the server and client and pretty much the structure of palmetto flow would not have to change. Basically the message type object is the only thing that has to change:

Instead of:

{
  subject: 'widget',
  verb: 'list',  
  object: {}
}

It might be something like:

{
  subject: 'batch',
  events: [{
    subject: 'widget',
    verb: 'list',
    object: {}
  }, {
    subject: 'cog',
    verb: 'get',
    object: { id: 1 }
  }]
}

This would enable palmetto flow to execute multiple requests in parallel and return the results in one response back.

It would give you a transactional batch system, that you could manage rollbacks in your palmetto flow service if needed.

But the big win is to keep your client components collocated with data models.

Any thoughts or comments?

twilson63 commented 8 years ago

@chennigan brought a good point, what if one service fails when a batch is being performed.

maybe the batch request has two modes : batch-all or batch-stream

If batch-all one fails all fail if batch-stream one fail the rest continue

Thoughts?

twilson63 commented 8 years ago

The other item I would like to propose is change the emit word from 'send' to 'data'

Why?

By changing it to data it should make the events readable streams, so that you could stream in events and stream out responses.