Pipeline Starts by Reading from PUBSUBIo. The message inside PubSub IO is a GCS file path. I know that I can use ReadAll() to emit the lines from each path. However, it doesn't serve my purpose(Information regarding the file path is lost). What I need is to emit is a KV<'Filepath','Lines inside files'>.
PubSUB messages will look like
Message1 -> gs://folder1/Topic1/topicfile1.gz
Message2 -> gs://folder1/Topic2/topicfile2.gz
Assume that the file contents are like below
topicfile1.gz
{
topic1.line1
topic1.line2
}
topicfile2.gz
{
topic2.line1
topic2.line2
}
What I am expecting is a pcollection like the one below
{KV<'gs://folder1/Topic1/topicfile1.gz','topic1.line1'>}
{KV<'gs://folder1/Topic1/topicfile1.gz','topic1.line2'>}
{KV<'gs://folder1/Topic2/topicfile2.gz','topic2.line1'>}
{KV<'gs://folder1/Topic2/topicfile2.gz','topic2.line2'>}
I could't find a way to read a file from a path inside the ParDo function to map the path to the lines.
Hope this is clear.