|
17 | 17 | import static com.rabbitmq.stream.perf.Utils.ENVIRONMENT_VARIABLE_PREFIX;
|
18 | 18 | import static com.rabbitmq.stream.perf.Utils.OPTION_TO_ENVIRONMENT_VARIABLE;
|
19 | 19 | import static java.lang.String.format;
|
| 20 | +import static java.time.Duration.ofMillis; |
20 | 21 |
|
21 | 22 | import com.google.common.util.concurrent.RateLimiter;
|
22 | 23 | import com.rabbitmq.client.Channel;
|
@@ -203,6 +204,13 @@ public class StreamPerfTest implements Callable<Integer> {
|
203 | 204 | converter = Utils.PositiveIntegerTypeConverter.class)
|
204 | 205 | private int batchSize;
|
205 | 206 |
|
| 207 | + @CommandLine.Option( |
| 208 | + names = {"--batch-publishing-delay", "-bpd"}, |
| 209 | + description = "Period to send a batch of messages in milliseconds", |
| 210 | + defaultValue = "100", |
| 211 | + converter = Utils.GreaterThanOrEqualToZeroIntegerTypeConverter.class) |
| 212 | + private int batchPublishingDelay; |
| 213 | + |
206 | 214 | @CommandLine.Option(
|
207 | 215 | names = {"--sub-entry-size", "-ses"},
|
208 | 216 | description = "number of messages packed into a normal message entry",
|
@@ -763,7 +771,10 @@ public Integer call() throws Exception {
|
763 | 771 | }
|
764 | 772 |
|
765 | 773 | String stream = stream(this.streams, i);
|
766 |
| - ProducerBuilder producerBuilder = environment.producerBuilder(); |
| 774 | + ProducerBuilder producerBuilder = |
| 775 | + environment |
| 776 | + .producerBuilder() |
| 777 | + .batchPublishingDelay(ofMillis(this.batchPublishingDelay)); |
767 | 778 |
|
768 | 779 | String producerName = this.producerNameStrategy.apply(stream, i + 1);
|
769 | 780 | if (producerName != null && !producerName.trim().isEmpty()) {
|
|
0 commit comments