headers.setString("Test", "MST");
properties.setHeaders(headers);
MessagePublishInfo messageInfo = new TestMessagePublishInfo(exchange, false, false, routingKey);
final IncomingMessage currentMessage;
currentMessage = new IncomingMessage(messageInfo);
currentMessage.setExchange(exchange);
ContentHeaderBody headerBody = new ContentHeaderBody();
headerBody.classId = BasicConsumeBodyImpl.CLASS_ID;
headerBody.bodySize = 0;
headerBody.setProperties(properties);
try
{
currentMessage.setContentHeaderBody(headerBody);
}
catch (AMQException e)
{
fail(e.getMessage());
}
currentMessage.setExpiration();
MessageMetaData mmd = currentMessage.headersReceived();
currentMessage.setStoredMessage(getVirtualHost().getMessageStore().addMessage(mmd));
currentMessage.getStoredMessage().flushToStore();
currentMessage.route();
// check and deliver if header says body length is zero
if (currentMessage.allContentReceived())
{
ServerTransaction trans = new AutoCommitTransaction(getVirtualHost().getMessageStore());
final List<? extends BaseQueue> destinationQueues = currentMessage.getDestinationQueues();
trans.enqueue(currentMessage.getDestinationQueues(), currentMessage, new ServerTransaction.Action() {
public void postCommit()
{
try
{
AMQMessage message = new AMQMessage(currentMessage.getStoredMessage());
for(BaseQueue queue : destinationQueues)
{
queue.enqueue(message);
}