Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions src/rmq/rmqa/rmqa_producerimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,9 @@ rmqp::Producer::SendStatus ProducerImpl::sendImpl(
const rmqp::Producer::ConfirmationCallback& confirmCallback,
const bsls::TimeInterval& timeout)
{
rmqt::Message transformedMsg;
if (d_transformers.size() > 0) {
if (!applyTransformations(transformedMsg, message)) {
BALL_LOG_ERROR << "Failed to apply transformations to message "
<< message.guid();
return rmqp::Producer::TRANSFORM_ERROR;
}
}
const rmqt::Message& realMsg =
d_transformers.size() > 0 ? transformedMsg : message;

BALL_LOG_TRACE
<< "Waiting on send(exchange) outstanding message limit for message "
<< realMsg;
<< message;

if (timeout.totalNanoseconds()) {
if (d_sharedState->outstandingMessagesCap.timedWait(
Expand All @@ -269,7 +258,7 @@ rmqp::Producer::SendStatus ProducerImpl::sendImpl(
d_sharedState->outstandingMessagesCap.wait();
}

return doSend(realMsg, routingKey, mandatoryFlag, confirmCallback);
return doSend(message, routingKey, mandatoryFlag, confirmCallback);
}

rmqp::Producer::SendStatus ProducerImpl::trySend(
Expand Down Expand Up @@ -305,13 +294,26 @@ rmqp::Producer::SendStatus ProducerImpl::doSend(
{
BALL_LOG_TRACE << "Below confirm limit";

if (!registerUniqueCallback(message.guid(), confirmCallback)) {
rmqt::Message transformedMsg;
if (d_transformers.size() > 0) {
if (!applyTransformations(transformedMsg, message)) {
BALL_LOG_ERROR << "Failed to apply transformations to message "
<< message.guid();
d_sharedState->outstandingMessagesCap.post();
return rmqp::Producer::TRANSFORM_ERROR;
}
}
const rmqt::Message& realMsg =
d_transformers.size() > 0 ? transformedMsg : message;

if (!registerUniqueCallback(realMsg.guid(), confirmCallback)) {
d_sharedState->outstandingMessagesCap.post();
return rmqp::Producer::DUPLICATE;
}

d_eventLoop.post(bdlf::BindUtil::bind(&rmqamqp::SendChannel::publishMessage,
d_channel,
message,
realMsg,
routingKey,
mandatory));

Expand Down
Loading