boolean immediate) throws JMSException
{
AMQMessageDelegate_0_8 delegate = (AMQMessageDelegate_0_8) message.getDelegate();
BasicContentHeaderProperties contentHeaderProperties = delegate.getContentHeaderProperties();
AMQShortString routingKey = destination.getRoutingKey();
FieldTable headers = delegate.getContentHeaderProperties().getHeaders();
if (destination.getDestSyntax() == AMQDestination.DestSyntax.ADDR &&
(destination.getSubject() != null
|| (headers != null && headers.get(QpidMessageProperties.QPID_SUBJECT) != null)))
{
if (headers.get(QpidMessageProperties.QPID_SUBJECT) == null)
{
// use default subject in address string
headers.setString(QpidMessageProperties.QPID_SUBJECT, destination.getSubject());
}
if (destination.getAddressType() == AMQDestination.TOPIC_TYPE)
{
routingKey = AMQShortString.valueOf(headers.getString(QpidMessageProperties.QPID_SUBJECT));
}
}
BasicPublishBody body = getSession().getMethodRegistry().createBasicPublishBody(getSession().getTicket(),
destination.getExchangeName(),
routingKey,
mandatory,
immediate);
AMQFrame publishFrame = body.generateFrame(getChannelId());
message.prepareForSending();
ByteBuffer payload = message.getData();
contentHeaderProperties.setUserId(getUserID());
//Set the JMS_QPID_DESTTYPE for 0-8/9 messages
int type;
if (destination instanceof Topic)
{
type = AMQDestination.TOPIC_TYPE;
}
else if (destination instanceof Queue)
{
type = AMQDestination.QUEUE_TYPE;
}
else
{
type = AMQDestination.UNKNOWN_TYPE;
}
//Set JMS_QPID_DESTTYPE
delegate.getContentHeaderProperties().getHeaders().setInteger(CustomJMSXProperty.JMS_QPID_DESTTYPE.getShortStringName(), type);
if (!isDisableTimestamps())
{
final long currentTime = System.currentTimeMillis();
contentHeaderProperties.setTimestamp(currentTime);