Skip to content

Let application own the Async Validation #647

@MarcoPolo

Description

@MarcoPolo

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:

  1. Receive a message from the network.
  2. Pass the unvalidated message to the application.
  3. The application at some point returns a validation result for that message.
  4. We forward as normal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions