[client] Provide a clock for generating publish timestamp for producers (#4562)
*Motivation* Currently producers uses `System.currentTimeMillis()` as publish timestamp by default. However at some use cases, producers would like to a different way for generating publish timestamp. E.g. in a database use case, a producer might be use HLC (Hybrid Logic Clock) as publish timestamp; in integration tests, it might require the producer to use a deterministic way to generate publish timestamp. *Changes* This PR introduces a `clock` in building the client. This allows applications to override the system clock with its own implementation. *Verify the change* Add unit test to test customized clock in both batch and non-batch cases. (cherry picked from commit 7397b960)
Showing
想要评论请 注册 或 登录