def __init__(self, max_size_in_bytes=None): # type: (Optional[int]) -> None self.max_size_in_bytes = max_size_in_bytes or uamqp.constants.MAX_MESSAGE_LENGTH_BYTES self.message = uamqp.BatchMessage(data=[], multi_messages=False, properties=None) self._size = self.message.gather()[0].get_message_encoded_size() self._count = 0 self._messages = [] # type: List[Message]
def _build_message(self, body): if body is None: raise ValueError("Message body cannot be None.") else: self.message = uamqp.BatchMessage(data=body, multi_messages=True, properties=self.properties, header=self.header)