30
30
import com .rabbitmq .stream .EnvironmentBuilder .TlsConfiguration ;
31
31
import com .rabbitmq .stream .OffsetSpecification ;
32
32
import com .rabbitmq .stream .Producer ;
33
+ import com .rabbitmq .stream .ProducerBuilder ;
33
34
import com .rabbitmq .stream .StreamCreator ;
34
35
import com .rabbitmq .stream .StreamCreator .LeaderLocator ;
35
36
import com .rabbitmq .stream .StreamException ;
@@ -258,6 +259,16 @@ public class StreamPerfTest implements Callable<Integer> {
258
259
converter = Utils .OneTo255RangeIntegerTypeConverter .class )
259
260
private int producersByConnection ;
260
261
262
+ @ CommandLine .Option (
263
+ names = {"--producer-names" , "-pn" },
264
+ description =
265
+ "naming strategy for producer names. Valid values are 'uuid' or a pattern with "
266
+ + "stream name and producer index as arguments. "
267
+ + "If set, a publishing ID is automatically assigned to each outbound message." ,
268
+ defaultValue = "" ,
269
+ converter = Utils .NameStrategyConverter .class )
270
+ private BiFunction <String , Integer , String > producerNameStrategy ;
271
+
261
272
@ CommandLine .Option (
262
273
names = {"--tracking-consumers-by-connection" , "-ccbc" },
263
274
description = "number of tracking consumers by connection. Value must be between 1 and 255." ,
@@ -284,7 +295,7 @@ public class StreamPerfTest implements Callable<Integer> {
284
295
"naming strategy for consumer names. Valid values are 'uuid' or a pattern with "
285
296
+ "stream name and consumer index as arguments." ,
286
297
defaultValue = "%s-%d" ,
287
- converter = Utils .ConsumerNameStrategyConverter .class )
298
+ converter = Utils .NameStrategyConverter .class )
288
299
private BiFunction <String , Integer , String > consumerNameStrategy ;
289
300
290
301
@ CommandLine .Option (
@@ -597,10 +608,17 @@ public Integer call() throws Exception {
597
608
}
598
609
599
610
String stream = stream ();
611
+ ProducerBuilder producerBuilder = environment .producerBuilder ();
612
+
613
+ String producerName = this .producerNameStrategy .apply (stream , i + 1 );
614
+ if (producerName != "" ) {
615
+ producerBuilder = producerBuilder
616
+ .name (producerName )
617
+ .confirmTimeout (Duration .ZERO );
618
+ }
600
619
601
620
Producer producer =
602
- environment
603
- .producerBuilder ()
621
+ producerBuilder
604
622
.subEntrySize (this .subEntrySize )
605
623
.batchSize (this .batchSize )
606
624
.compression (
0 commit comments