<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Using streaming data received from Pub/sub topic in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/using-streaming-data-received-from-pub-sub-topic/m-p/59464#M6449</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I have a notebook in Databricks in which I am streaming a Pub/sub topic. The code for this looks like following-&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;%pip install --upgrade google-cloud-pubsub[pandas]    
from pyspark.sql import SparkSession

authOptions={"clientId" : "123","clientEmail" : "123@project-id.iam.gserviceaccount.com", "privateKey" : "-----BEGIN PRIVATE KEY-----1234-----END PRIVATE KEY-----\n","privateKeyId" : "1234"}    
stream=spark.readStream.format("pubsub").option("subscriptionId","firstfuel-reporting-test-subscription").option("topicId","firstfuel-reporting-test").option("projectId","project-id").options(**authOptions).load()
decodedStream = stream.withColumn("decodedData", stream["payload"].cast("string"))
result = decodedStream.writeStream.outputMode("append").format("console").start()&lt;/PRE&gt;&lt;P&gt;When I run this, I can see that streaming starts successfully and any mesages published on the Pub/sub topic are acknowledged right away. But ,I am not able to see exact payload printed on console. How can I do that. If I have to use received messages for any other purpose, how can I do that? I am attaching a view of what I am seeing after streaming starts below-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2024 13:04:24 GMT</pubDate>
    <dc:creator>sumitdesai</dc:creator>
    <dc:date>2024-02-06T13:04:24Z</dc:date>
    <item>
      <title>Using streaming data received from Pub/sub topic</title>
      <link>https://community.databricks.com/t5/get-started-discussions/using-streaming-data-received-from-pub-sub-topic/m-p/59464#M6449</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a notebook in Databricks in which I am streaming a Pub/sub topic. The code for this looks like following-&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;%pip install --upgrade google-cloud-pubsub[pandas]    
from pyspark.sql import SparkSession

authOptions={"clientId" : "123","clientEmail" : "123@project-id.iam.gserviceaccount.com", "privateKey" : "-----BEGIN PRIVATE KEY-----1234-----END PRIVATE KEY-----\n","privateKeyId" : "1234"}    
stream=spark.readStream.format("pubsub").option("subscriptionId","firstfuel-reporting-test-subscription").option("topicId","firstfuel-reporting-test").option("projectId","project-id").options(**authOptions).load()
decodedStream = stream.withColumn("decodedData", stream["payload"].cast("string"))
result = decodedStream.writeStream.outputMode("append").format("console").start()&lt;/PRE&gt;&lt;P&gt;When I run this, I can see that streaming starts successfully and any mesages published on the Pub/sub topic are acknowledged right away. But ,I am not able to see exact payload printed on console. How can I do that. If I have to use received messages for any other purpose, how can I do that? I am attaching a view of what I am seeing after streaming starts below-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 13:04:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/using-streaming-data-received-from-pub-sub-topic/m-p/59464#M6449</guid>
      <dc:creator>sumitdesai</dc:creator>
      <dc:date>2024-02-06T13:04:24Z</dc:date>
    </item>
  </channel>
</rss>

