Search in sources :

Example 1 with CommandSend

use of org.apache.pulsar.common.api.proto.CommandSend in project pulsar by apache.

the class Commands method newSend.

public static ByteBufPair newSend(long producerId, long sequenceId, long highestSequenceId, int numMessages, long txnIdLeastBits, long txnIdMostBits, ChecksumType checksumType, MessageMetadata messageData, ByteBuf payload) {
    BaseCommand cmd = localCmd(Type.SEND);
    CommandSend send = cmd.setSend().setProducerId(producerId).setSequenceId(sequenceId);
    if (highestSequenceId >= 0) {
        send.setHighestSequenceId(highestSequenceId);
    }
    if (numMessages > 1) {
        send.setNumMessages(numMessages);
    }
    if (txnIdLeastBits >= 0) {
        send.setTxnidLeastBits(txnIdLeastBits);
    }
    if (txnIdMostBits >= 0) {
        send.setTxnidMostBits(txnIdMostBits);
    }
    if (messageData.hasTotalChunkMsgSize() && messageData.getTotalChunkMsgSize() > 1) {
        send.setIsChunk(true);
    }
    if (messageData.hasMarkerType()) {
        send.setMarker(true);
    }
    return serializeCommandSendWithSize(cmd, checksumType, messageData, payload);
}
Also used : CommandSend(org.apache.pulsar.common.api.proto.CommandSend) BaseCommand(org.apache.pulsar.common.api.proto.BaseCommand)

Aggregations

BaseCommand (org.apache.pulsar.common.api.proto.BaseCommand)1 CommandSend (org.apache.pulsar.common.api.proto.CommandSend)1