in python-batch/batch.py [0:0]
def publish_fifo_ids(self):
"""
Publish integer ID messages to the pubsub topic.
Simple queue create via the Pubsub Topic to create queue.
If the queue is not fully pulled, the project can restart with the same queue.
Picking up where it left off.
Args:
None
Returns:
None
"""
self.order_key = "fifo"
for i in range(0, self.config["task_count"] ):
# Data must be a bytestring
data = str(i).encode("utf-8")
# When you publish a message, the client returns a future.
future = self.publisher.publish(self.topic_path, data=data, ordering_key=self.order_key)
if FLAGS.debug:
print(f'Future: {future.result()}, Message: {data}', file=sys.stderr)