Search in sources :

Example 1 with AMQBody

use of org.apache.qpid.server.protocol.v0_8.transport.AMQBody in project qpid-broker-j by apache.

the class Interaction method sendPerformative.

public Interaction sendPerformative(int channel, final AMQBody amqBody) throws Exception {
    final AMQFrame frameBody = new AMQFrame(channel, amqBody);
    sendPerformativeAndChainFuture(frameBody);
    return this;
}
Also used : AMQFrame(org.apache.qpid.server.protocol.v0_8.transport.AMQFrame)

Example 2 with AMQBody

use of org.apache.qpid.server.protocol.v0_8.transport.AMQBody in project qpid-broker-j by apache.

the class ProtocolOutputConverterImpl method writeReturn.

@Override
public void writeReturn(MessagePublishInfo messagePublishInfo, ContentHeaderBody header, MessageContentSource message, int channelId, int replyCode, AMQShortString replyText) {
    AMQBody returnFrame = createEncodedReturnFrame(messagePublishInfo, replyCode, replyText);
    writeMessageDelivery(message, header, channelId, returnFrame);
}
Also used : AMQBody(org.apache.qpid.server.protocol.v0_8.transport.AMQBody)

Example 3 with AMQBody

use of org.apache.qpid.server.protocol.v0_8.transport.AMQBody in project qpid-broker-j by apache.

the class ProtocolOutputConverterImpl method writeDeliver.

@Override
public long writeDeliver(final AMQMessage msg, final InstanceProperties props, int channelId, long deliveryTag, AMQShortString consumerTag) {
    final boolean isRedelivered = Boolean.TRUE.equals(props.getProperty(InstanceProperties.Property.REDELIVERED));
    AMQBody deliverBody = createEncodedDeliverBody(msg, isRedelivered, deliveryTag, consumerTag);
    return writeMessageDelivery(msg, channelId, deliverBody);
}
Also used : AMQBody(org.apache.qpid.server.protocol.v0_8.transport.AMQBody)

Example 4 with AMQBody

use of org.apache.qpid.server.protocol.v0_8.transport.AMQBody in project qpid-broker-j by apache.

the class ProtocolOutputConverterImpl method writeMessageDeliveryUnchanged.

private void writeMessageDeliveryUnchanged(MessageContentSource content, int channelId, AMQBody deliverBody, ContentHeaderBody contentHeaderBody, int bodySize) {
    if (bodySize == 0) {
        SmallCompositeAMQBodyBlock compositeBlock = new SmallCompositeAMQBodyBlock(channelId, deliverBody, contentHeaderBody);
        writeFrame(compositeBlock);
    } else {
        int maxBodySize = (int) _connection.getMaxFrameSize() - AMQFrame.getFrameOverhead();
        int capacity = bodySize > maxBodySize ? maxBodySize : bodySize;
        int writtenSize = capacity;
        AMQBody firstContentBody = new MessageContentSourceBody(content, 0, capacity);
        CompositeAMQBodyBlock compositeBlock = new CompositeAMQBodyBlock(channelId, deliverBody, contentHeaderBody, firstContentBody);
        writeFrame(compositeBlock);
        while (writtenSize < bodySize) {
            capacity = bodySize - writtenSize > maxBodySize ? maxBodySize : bodySize - writtenSize;
            AMQBody body = new MessageContentSourceBody(content, writtenSize, capacity);
            writtenSize += capacity;
            writeFrame(new AMQFrame(channelId, body));
        }
    }
}
Also used : AMQBody(org.apache.qpid.server.protocol.v0_8.transport.AMQBody) AMQFrame(org.apache.qpid.server.protocol.v0_8.transport.AMQFrame)

Example 5 with AMQBody

use of org.apache.qpid.server.protocol.v0_8.transport.AMQBody in project qpid-broker-j by apache.

the class ProtocolOutputConverterImpl method createEncodedGetOkBody.

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);
}
Also used : MessagePublishInfo(org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)

Aggregations

AMQBody (org.apache.qpid.server.protocol.v0_8.transport.AMQBody)5 AMQFrame (org.apache.qpid.server.protocol.v0_8.transport.AMQFrame)4 ByteBuffer (java.nio.ByteBuffer)2 QpidByteBuffer (org.apache.qpid.server.bytebuffer.QpidByteBuffer)2 AMQDataBlock (org.apache.qpid.server.protocol.v0_8.transport.AMQDataBlock)2 BasicContentHeaderProperties (org.apache.qpid.server.protocol.v0_8.transport.BasicContentHeaderProperties)2 ContentHeaderBody (org.apache.qpid.server.protocol.v0_8.transport.ContentHeaderBody)2 MessagePublishInfo (org.apache.qpid.server.protocol.v0_8.transport.MessagePublishInfo)2 Random (java.util.Random)1 ContentBody (org.apache.qpid.server.protocol.v0_8.transport.ContentBody)1