Skip to content

Commit

Permalink
ARTEMIS-715 messages could be sent to wrong queue
Browse files Browse the repository at this point in the history
In rare circumstances MessageProducer can send a message
to wrong queue
  • Loading branch information
treblereel committed Sep 19, 2016
1 parent 04acde0 commit 8e636ca
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,16 @@ private void doSend(SimpleString sendingAddress,
largeMessageSend(sendBlocking, msgI, theCredits, handler);
}
else {
sendRegularMessage(msgI, sendBlocking, theCredits, handler);
session.checkDefaultAddress(sendingAddress);
sendRegularMessage(sendingAddress, msgI, sendBlocking, theCredits, handler);
}
}
finally {
session.endCall();
}
}

private void sendRegularMessage(final MessageInternal msgI,
private void sendRegularMessage(final SimpleString sendingAddress,
final MessageInternal msgI,
final boolean sendBlocking,
final ClientProducerCredits theCredits,
final SendAcknowledgementHandler handler) throws ActiveMQException {
Expand All @@ -280,6 +280,8 @@ private void sendRegularMessage(final MessageInternal msgI,

theCredits.acquireCredits(creditSize);

session.checkDefaultAddress(sendingAddress);

sessionContext.sendFullMessage(msgI, sendBlocking, handler, address);
}

Expand Down Expand Up @@ -479,7 +481,7 @@ private void largeMessageSendStreamed(final boolean sendBlocking,
msgI.putLongProperty(Message.HDR_LARGE_BODY_SIZE, deflaterReader.getTotalSize());

msgI.getBodyBuffer().writeBytes(buff, 0, pos);
sendRegularMessage(msgI, sendBlocking, credits, handler);
sendRegularMessage(msgI.getAddress(), msgI, sendBlocking, credits, handler);
return;
}
else {
Expand Down

0 comments on commit 8e636ca

Please sign in to comment.