message.getJmsHeaders().setInteger(CustomJMSXProperty.JMS_QPID_DESTTYPE.getShortStringName(), type);
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
// Be aware of possible changes to parameter order as versions change.
AMQFrame publishFrame =
BasicPublishBody.createAMQFrame(_channelId, _protocolHandler.getProtocolMajorVersion(),
_protocolHandler.getProtocolMinorVersion(), destination.getExchangeName(), // exchange
immediate, // immediate
mandatory, // mandatory
destination.getRoutingKey(), // routingKey
_session.getTicket()); // ticket
message.prepareForSending();
ByteBuffer payload = message.getData();
BasicContentHeaderProperties contentHeaderProperties = message.getContentHeaderProperties();
if (!_disableTimestamps)
{
final long currentTime = System.currentTimeMillis();
contentHeaderProperties.setTimestamp(currentTime);
if (timeToLive > 0)
{
contentHeaderProperties.setExpiration(currentTime + timeToLive);
}
else
{
contentHeaderProperties.setExpiration(0);
}
}
contentHeaderProperties.setDeliveryMode((byte) deliveryMode);
contentHeaderProperties.setPriority((byte) priority);
final int size = (payload != null) ? payload.limit() : 0;
final int contentBodyFrameCount = calculateContentBodyFrameCount(payload);
final AMQFrame[] frames = new AMQFrame[2 + contentBodyFrameCount];
if (payload != null)
{
createContentBodies(payload, frames, 2, _channelId);
}
if ((contentBodyFrameCount != 0) && _logger.isDebugEnabled())
{
_logger.debug("Sending content body frames to " + destination);
}
// weight argument of zero indicates no child content headers, just bodies
// AMQP version change: Hardwire the version to 0-8 (major=8, minor=0)
// TODO: Connect this to the session version obtained from ProtocolInitiation for this session.
AMQFrame contentHeaderFrame =
ContentHeaderBody.createAMQFrame(_channelId,
BasicConsumeBody.getClazz(_protocolHandler.getProtocolMajorVersion(),
_protocolHandler.getProtocolMinorVersion()), 0, contentHeaderProperties, size);
if (_logger.isDebugEnabled())
{