-
Notifications
You must be signed in to change notification settings - Fork 208
Description
The way async validation works today is that this library owns the validation goroutines and validation queue. This is fine for the simple case, but limits the application in how exactly validation can be done. For example, if an application wanted to validate messages in batches, it would be hard and awkward with the current design. Another issue with the current design is that it encourages configuration to control the library's resource usage rather than having the application drive the resource usage. For example the WithValidateThrottle
, WithValidateQueueSize
, and WithValidateWorkers
are all configuration options that control the goroutine usage within the library. By having the application in charge of async validation, these options are no longer needed. The application manages its own resources directly.
At a high level the change would look something like:
- Receive a message from the network.
- Pass the unvalidated message to the application.
- The application at some point returns a validation result for that message.
- We forward as normal.