@@ -51,6 +51,8 @@ public class MulticastParams {
5151 private boolean exclusive = true ;
5252 private boolean autoDelete = false ;
5353
54+ private boolean predeclared ;
55+
5456 public void setExchangeType (String exchangeType ) {
5557 this .exchangeType = exchangeType ;
5658 }
@@ -132,6 +134,10 @@ public void setAutoDelete(boolean autoDelete) {
132134 this .autoDelete = autoDelete ;
133135 }
134136
137+ public void setPredeclared (boolean predeclared ) {
138+ this .predeclared = predeclared ;
139+ }
140+
135141 public int getConsumerCount () {
136142 return consumerCount ;
137143 }
@@ -148,7 +154,7 @@ public Producer createProducer(Connection connection, Stats stats, String id) th
148154 Channel channel = connection .createChannel ();
149155 if (producerTxSize > 0 ) channel .txSelect ();
150156 if (confirm >= 0 ) channel .confirmSelect ();
151- if (!exchangeExists (connection , exchangeName )) {
157+ if (!predeclared || ! exchangeExists (connection , exchangeName )) {
152158 channel .exchangeDeclare (exchangeName , exchangeType );
153159 }
154160 final Producer producer = new Producer (channel , exchangeName , id ,
@@ -177,11 +183,11 @@ public boolean shouldConfigureQueue() {
177183
178184 public String configureQueue (Connection connection , String id ) throws IOException {
179185 Channel channel = connection .createChannel ();
180- if (!exchangeExists (connection , exchangeName )) {
186+ if (!predeclared || ! exchangeExists (connection , exchangeName )) {
181187 channel .exchangeDeclare (exchangeName , exchangeType );
182188 }
183189 String qName = queueName ;
184- if (!queueExists (connection , queueName )) {
190+ if (!predeclared || ! queueExists (connection , queueName )) {
185191 qName = channel .queueDeclare (queueName ,
186192 flags .contains ("persistent" ),
187193 exclusive , autoDelete ,
0 commit comments