Package org.apache.pulsar.client.impl
Interface BatchMessageContainerBase
-
- All Superinterfaces:
org.apache.pulsar.client.api.BatchMessageContainer
- All Known Implementing Classes:
AbstractBatchMessageContainer
public interface BatchMessageContainerBase extends org.apache.pulsar.client.api.BatchMessageContainer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
add(MessageImpl<?> msg, SendCallback callback)
Add message to the batch message container.ProducerImpl.OpSendMsg
createOpSendMsg()
Create OpSendMsg, producer use OpSendMsg to send to the broker.java.util.List<ProducerImpl.OpSendMsg>
createOpSendMsgs()
Create list of OpSendMsg, producer use OpSendMsg to send to the broker.boolean
hasSameSchema(MessageImpl<?> msg)
Check the batch message container has same schema with the message want to add.boolean
hasSameTxn(MessageImpl<?> msg)
Check whether the added message belong to the same txn with batch message container.boolean
haveEnoughSpace(MessageImpl<?> msg)
Check the batch message container have enough space for the message want to add.void
setProducer(ProducerImpl<?> producer)
Set producer of the message batch container.
-
-
-
Method Detail
-
add
boolean add(MessageImpl<?> msg, SendCallback callback)
Add message to the batch message container.- Parameters:
msg
- message will add to the batch message containercallback
- message send callback- Returns:
- true if the batch is full, otherwise false
-
haveEnoughSpace
boolean haveEnoughSpace(MessageImpl<?> msg)
Check the batch message container have enough space for the message want to add.- Parameters:
msg
- the message want to add- Returns:
- return true if the container have enough space for the specific message, otherwise return false.
-
hasSameSchema
boolean hasSameSchema(MessageImpl<?> msg)
Check the batch message container has same schema with the message want to add.- Parameters:
msg
- the message want to add- Returns:
- return true if the container has same schema with the specific message, otherwise return false.
-
setProducer
void setProducer(ProducerImpl<?> producer)
Set producer of the message batch container.- Parameters:
producer
- producer
-
createOpSendMsgs
java.util.List<ProducerImpl.OpSendMsg> createOpSendMsgs() throws java.io.IOException
Create list of OpSendMsg, producer use OpSendMsg to send to the broker.- Returns:
- list of OpSendMsg
- Throws:
java.io.IOException
-
createOpSendMsg
ProducerImpl.OpSendMsg createOpSendMsg() throws java.io.IOException
Create OpSendMsg, producer use OpSendMsg to send to the broker.- Returns:
- OpSendMsg
- Throws:
java.io.IOException
-
hasSameTxn
boolean hasSameTxn(MessageImpl<?> msg)
Check whether the added message belong to the same txn with batch message container.- Parameters:
msg
- added message- Returns:
- belong to the same txn or not
-
-