Skip to content

Commit 3a7d68b

Browse files
committed
merge bug21673 into default
2 parents f5b9cc4 + a5f2402 commit 3a7d68b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

test/src/com/rabbitmq/examples/ProducerMain.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import com.rabbitmq.client.Connection;
4141
import com.rabbitmq.client.ConnectionFactory;
4242
import com.rabbitmq.client.MessageProperties;
43+
import com.rabbitmq.client.AMQP.BasicProperties;
4344

4445
public class ProducerMain implements Runnable {
4546
public static final int SUMMARY_EVERY_MS = 1000;
@@ -191,6 +192,9 @@ public void sendBatch(String queueName) throws IOException {
191192

192193
long nextSummaryTime = startTime + SUMMARY_EVERY_MS;
193194
byte[] message = new byte[256];
195+
BasicProperties props = shouldPersist() ?
196+
MessageProperties.MINIMAL_PERSISTENT_BASIC :
197+
MessageProperties.MINIMAL_BASIC;
194198
for (int i = 0; i < _messageCount; i++) {
195199
ByteArrayOutputStream acc = new ByteArrayOutputStream();
196200
DataOutputStream d = new DataOutputStream(acc);
@@ -205,8 +209,7 @@ public void sendBatch(String queueName) throws IOException {
205209
acc.flush();
206210
byte[] message0 = acc.toByteArray();
207211
System.arraycopy(message0, 0, message, 0, message0.length);
208-
_channel.basicPublish("", queueName, shouldPersist() ? MessageProperties.MINIMAL_PERSISTENT_BASIC : MessageProperties.MINIMAL_BASIC,
209-
message);
212+
_channel.basicPublish("", queueName, props, message);
210213
sent++;
211214
if (shouldCommit()) {
212215
if ((sent % _commitEvery) == 0) {

0 commit comments

Comments
 (0)