3131import io .netty .channel .EventLoop ;
3232import org .apache .activemq .artemis .cli .commands .ActionContext ;
3333import org .apache .activemq .artemis .cli .commands .messages .ConnectionProtocol ;
34+ import org .apache .activemq .artemis .cli .factory .ConnectionFactoryClosable ;
3435import org .apache .activemq .artemis .jms .client .ActiveMQDestination ;
3536import picocli .CommandLine .Command ;
3637import picocli .CommandLine .Option ;
@@ -98,7 +99,6 @@ public class PerfClientCommand extends PerfCommand {
9899 protected void onExecuteBenchmark (final ConnectionFactory producerConnectionFactory , final Destination [] jmsDestinations , final ActionContext context ) throws Exception {
99100 final ConnectionProtocol listenerProtocol = Objects .requireNonNullElse (this .consumerProtocol , protocol );
100101 final String listenerUrl = Objects .requireNonNullElse (this .consumerUrl , brokerURL );
101- final ConnectionFactory consumerConnectionFactory = createConnectionFactory (listenerUrl , user , password , null , listenerProtocol );
102102 if (consumerConnections == 0 ) {
103103 if (sharedSubscription > 0 ) {
104104 if (getClientID () == null ) {
@@ -122,7 +122,8 @@ protected void onExecuteBenchmark(final ConnectionFactory producerConnectionFact
122122 boolean warmingUp = warmup != 0 ;
123123 final LiveStatistics statistics ;
124124 final StringBuilder skratchBuffer = new StringBuilder ();
125- try (MessageListenerBenchmark consumerBenchmark = new MessageListenerBenchmarkBuilder ()
125+ try (ConnectionFactoryClosable consumerConnectionFactory = createConnectionFactory (listenerUrl , user , password , null , listenerProtocol );
126+ MessageListenerBenchmark consumerBenchmark = new MessageListenerBenchmarkBuilder ()
126127 .setClientID (getClientID ())
127128 .setDestinations (consumerProtocol != null ? lookupDestinations (consumerConnectionFactory ) : jmsDestinations )
128129 .setFactory (consumerConnectionFactory )
0 commit comments