Multi provider strategy
jnoleau opened this issue · comments
Make generic the strategy attached to a channel.
The idea is to be able to define a function implementing the strategy. A strategy takes all provider in input and return a "new" provider.
channels {
sms: {
providers: [...]
multiProviderStrategy: string /* actual*/
| (SmsProviderInstance[]) => ((req) => Promise<string>)
}
}
Refactor existing strategies would be easy
fallback : (providers) => // try with the first and recursively try on error
round-robin (no-fallback) : (providers) => provider[n]