@Override public String getInitialRoutingAddress() { MessageMetaData messageMetaData = getMessageMetaData(); AMQShortString routingKey = messageMetaData.getMessagePublishInfo().getRoutingKey(); if (routingKey != null) { return routingKey.toString(); } return ""; }
private AMQBody createEncodedDeliverBody(AMQMessage message, boolean isRedelivered, final long deliveryTag, final AMQShortString consumerTag) { final AMQShortString exchangeName; final AMQShortString routingKey; final MessagePublishInfo pb = message.getMessagePublishInfo(); exchangeName = pb.getExchange(); routingKey = pb.getRoutingKey(); return new EncodedDeliveryBody(deliveryTag, routingKey, exchangeName, consumerTag, isRedelivered); }
private AMQBody createEncodedReturnFrame(MessagePublishInfo messagePublishInfo, int replyCode, AMQShortString replyText) { return _connection.getMethodRegistry().createBasicReturnBody(replyCode, replyText, messagePublishInfo.getExchange(), messagePublishInfo.getRoutingKey()); }
private AMQBody createEncodedGetOkBody(AMQMessage message, InstanceProperties props, long deliveryTag, int queueSize) { final AMQShortString exchangeName; final AMQShortString routingKey; final MessagePublishInfo pb = message.getMessagePublishInfo(); exchangeName = pb.getExchange(); routingKey = pb.getRoutingKey(); final boolean isRedelivered = Boolean.TRUE.equals(props.getProperty(InstanceProperties.Property.REDELIVERED)); return _connection.getMethodRegistry().createBasicGetOkBody(deliveryTag, isRedelivered, exchangeName, routingKey, queueSize); }
@Override public int getStorableSize() { int size = _contentHeaderBody.getSize(); size += 4; size += EncodingUtils.encodedShortStringLength(_messagePublishInfo.getExchange()); size += EncodingUtils.encodedShortStringLength(_messagePublishInfo.getRoutingKey()); size += 1; // flags for immediate/mandatory size += EncodingUtils.encodedLongLength(); return size; }
@Override public void writeToBuffer(final QpidByteBuffer dest) { dest.putInt(_contentHeaderBody.getSize()); _contentHeaderBody.writePayload(dest); EncodingUtils.writeShortStringBytes(dest, _messagePublishInfo.getExchange()); EncodingUtils.writeShortStringBytes(dest, _messagePublishInfo.getRoutingKey()); byte flags = 0; if(_messagePublishInfo.isMandatory()) { flags |= MANDATORY_FLAG; } if(_messagePublishInfo.isImmediate()) { flags |= IMMEDIATE_FLAG; } dest.put(flags); dest.putLong(_arrivalTime); }
if (messagePublishInfo.getRoutingKey() != null) String routingKey = AMQShortString.toString(messagePublishInfo.getRoutingKey()); if (to != null && !"".equals(to))
@Override public QpidByteBuffer convertToMessageFormat(final AMQMessage message) { final MessagePublishInfo messagePublishInfo = message.getMessagePublishInfo(); final ContentHeaderBody contentHeaderBody = message.getContentHeaderBody(); AMQShortString exchange = messagePublishInfo.getExchange(); AMQShortString routingKey = messagePublishInfo.getRoutingKey(); int length = contentHeaderBody.getSize() + (exchange == null ? 0 : exchange.length()) + (routingKey == null ? 0 : routingKey.length()) + 3; try (QpidByteBuffer headerBuf = QpidByteBuffer.allocateDirect(length); QpidByteBuffer content = message.getContent()) { EncodingUtils.writeShortStringBytes(headerBuf, exchange); EncodingUtils.writeShortStringBytes(headerBuf, routingKey); byte flags = messagePublishInfo.isMandatory() ? (byte) 0 : MANDATORY_MASK; if (messagePublishInfo.isImmediate()) { flags |= IMMEDIATE_MASK; } headerBuf.put(flags); headerBuf.flip(); contentHeaderBody.writePayload(headerBuf); return QpidByteBuffer.concatenate(headerBuf, content); } }
String routingKey = AMQShortString.toString(info.getRoutingKey()); String exchangeName = AMQShortString.toString(info.getExchange());