This example shows how to set a different partitioner depending on the topic.
()
| 492 | |
| 493 | // This example shows how to set a different partitioner depending on the topic. |
| 494 | func ExamplePartitioner_per_topic() { |
| 495 | config := NewTestConfig() |
| 496 | config.Producer.Partitioner = func(topic string) Partitioner { |
| 497 | switch topic { |
| 498 | case "access_log", "error_log": |
| 499 | return NewRandomPartitioner(topic) |
| 500 | |
| 501 | default: |
| 502 | return NewHashPartitioner(topic) |
| 503 | } |
| 504 | } |
| 505 | |
| 506 | // ... |
| 507 | } |
nothing calls this directly
no test coverage detected