apparatus / mu

A message based router for building distributed systems
MIT License
26 stars 1 forks source link

some kind of fallback + copy adapter #62

Open davidmarkclements opened 7 years ago

davidmarkclements commented 7 years ago

prime use case is hydrating local state from a remote source (particularly in a web app scenario) then replay from local

mu.outbound('*', hydrate(local(), ws.client(opts)))

@pelger @mcollina is there an analogous term for this (as with tee and balance)

mcollina commented 7 years ago

I would call it hydrate. It's a good term. However, I'm missing a bit its usefulness, fake req/response on first boot?

davidmarkclements commented 7 years ago

mu.dispatch(somePattern) => route to local => not found => route to ws => found => add to local pattern router (bloomrun) => respond

mu.dispatch(somePattern) => route to local => found => respond

this needs something exposed from the transport that allows patterns to be defined externally

other possibilities could be lazy data replication across services

mu.outbound('*', hydrate(tcp.client(service1), tcp.client(service2))) // try service one first, if not there, get from service2, copy to service1

and of course, local caching

mu.outbound('*', hydrate(local(), tcp.client(service1))) // cache locally for rapid responses

maybe use lru-cache with timeouts to implement

word hydrate might not fit to these other cases, but the logic translate by and large

mcollina commented 7 years ago

This seems more a caching layer, rather than hydrating. I'm still missing the use case.