/** * Helper method that is used currently by the persistence layer. * @param buffer buffer to decode * @param size size of the body * * @return the decoded header body * @throws AMQFrameDecodingException if there is a decoding issue * @throws AMQProtocolVersionException if there is a version issue */ public static ContentHeaderBody createFromBuffer(QpidByteBuffer buffer, long size) throws AMQFrameDecodingException, AMQProtocolVersionException { ContentHeaderBody body = new ContentHeaderBody(buffer, size); return body; }
public static AMQFrame createAMQFrame(int channelId, BasicContentHeaderProperties properties, long bodySize) { return new AMQFrame(channelId, new ContentHeaderBody(properties, bodySize)); }
@Override public void receiveMessageHeader(final BasicContentHeaderProperties properties, final long bodySize) { _processedMethods.add(new AMQFrame(_channelId, new ContentHeaderBody(properties, bodySize))); }
private int writeMessageDeliveryModified(final MessageContentSource content, final int channelId, final AMQBody deliverBody, final BasicContentHeaderProperties modifiedProps) { final int bodySize = (int) content.getSize(); ContentHeaderBody modifiedHeaderBody = new ContentHeaderBody(modifiedProps, bodySize); writeMessageDeliveryUnchanged(content, channelId, deliverBody, modifiedHeaderBody, bodySize); return bodySize; }
private ContentHeaderBody readContentBody(final QpidByteBuffer buf) throws AMQFrameDecodingException { long size = buf.getUnsignedInt(); try (QpidByteBuffer buffer = readByteBuffer(buf, size)) { final long newPosition = buf.position() + size; if (newPosition > Integer.MAX_VALUE) { throw new IllegalStateException(String.format("trying to advance QBB to %d which is larger than MAX_INT", newPosition)); } buf.position((int) newPosition); return new ContentHeaderBody(buffer, size); } }
@Override public void receiveMessageHeader(final BasicContentHeaderProperties properties, final long bodySize) { if(LOGGER.isDebugEnabled()) { LOGGER.debug("RECV[" + _channelId + "] MessageHeader[ properties: {" + properties + "} bodySize: " + bodySize + " ]"); } if(hasCurrentMessage()) { if(bodySize > _connection.getMaxMessageSize()) { properties.dispose(); closeChannel(ErrorCodes.MESSAGE_TOO_LARGE, "Message size of " + bodySize + " greater than allowed maximum of " + _connection.getMaxMessageSize()); } else { publishContentHeader(new ContentHeaderBody(properties, bodySize)); } } else { properties.dispose(); _connection.sendConnectionClose(ErrorCodes.COMMAND_INVALID, "Attempt to send a content header without first sending a publish frame", _channelId); } }
final ContentHeaderBody chb = new ContentHeaderBody(props); chb.setBodySize(size);
final ContentHeaderBody chb = new ContentHeaderBody(props); chb.setBodySize(size); return new MessageMetaData(publishInfo, chb, serverMsg.getArrivalTime());