Skip to content

Commit 6bf01ec

Browse files
committed
Add dataschema attribute to CloudEvents in Bluesky producer
- Added dataschema URLs for all six event types (Post, Like, Repost, Follow, Block, Profile) - Schema URLs point to Fabric Event Stream messaging catalog with correct versions - Enables proper schema validation in Fabric Event Streams
1 parent 9c6169a commit 6bf01ec

File tree

1 file changed

+12
-6
lines changed
  • bluesky/bluesky_producer/bluesky-producer_kafka_producer/src/bluesky_producer_kafka_producer

1 file changed

+12
-6
lines changed

bluesky/bluesky_producer/bluesky-producer_kafka_producer/src/bluesky_producer_kafka_producer/producer.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def send_bluesky_feed_post(self,_firehoseurl : str, _did : str, data: Post, cont
5959
"specversion":"1.0",
6060
"type":"Bluesky.Feed.Post",
6161
"source":"{firehoseurl}".format(firehoseurl = _firehoseurl),
62-
"subject":"{did}".format(did = _did)
62+
"subject":"{did}".format(did = _did),
63+
"dataschema":"https://c98acd97-4363-4296-8323-b6ab21e53903.westcentralus.messagingcatalog.azure.net/schemagroups/f043d8c3-32c7-4c3e-8527-d79e0ac996e5/schemas/Bluesky.Feed.Post/versions/v1"
6364
}
6465
attributes["datacontenttype"] = content_type
6566
event = CloudEvent.create(attributes, data)
@@ -92,7 +93,8 @@ def send_bluesky_feed_like(self,_firehoseurl : str, _did : str, data: Like, cont
9293
"specversion":"1.0",
9394
"type":"Bluesky.Feed.Like",
9495
"source":"{firehoseurl}".format(firehoseurl = _firehoseurl),
95-
"subject":"{did}".format(did = _did)
96+
"subject":"{did}".format(did = _did),
97+
"dataschema":"https://c98acd97-4363-4296-8323-b6ab21e53903.westcentralus.messagingcatalog.azure.net/schemagroups/f043d8c3-32c7-4c3e-8527-d79e0ac996e5/schemas/Bluesky.Feed.Like/versions/v2"
9698
}
9799
attributes["datacontenttype"] = content_type
98100
event = CloudEvent.create(attributes, data)
@@ -125,7 +127,8 @@ def send_bluesky_feed_repost(self,_firehoseurl : str, _did : str, data: Repost,
125127
"specversion":"1.0",
126128
"type":"Bluesky.Feed.Repost",
127129
"source":"{firehoseurl}".format(firehoseurl = _firehoseurl),
128-
"subject":"{did}".format(did = _did)
130+
"subject":"{did}".format(did = _did),
131+
"dataschema":"https://c98acd97-4363-4296-8323-b6ab21e53903.westcentralus.messagingcatalog.azure.net/schemagroups/f043d8c3-32c7-4c3e-8527-d79e0ac996e5/schemas/Bluesky.Feed.Repost/versions/v1"
129132
}
130133
attributes["datacontenttype"] = content_type
131134
event = CloudEvent.create(attributes, data)
@@ -158,7 +161,8 @@ def send_bluesky_graph_follow(self,_firehoseurl : str, _did : str, data: Follow,
158161
"specversion":"1.0",
159162
"type":"Bluesky.Graph.Follow",
160163
"source":"{firehoseurl}".format(firehoseurl = _firehoseurl),
161-
"subject":"{did}".format(did = _did)
164+
"subject":"{did}".format(did = _did),
165+
"dataschema":"https://c98acd97-4363-4296-8323-b6ab21e53903.westcentralus.messagingcatalog.azure.net/schemagroups/f043d8c3-32c7-4c3e-8527-d79e0ac996e5/schemas/Bluesky.Graph.Follow/versions/v1"
162166
}
163167
attributes["datacontenttype"] = content_type
164168
event = CloudEvent.create(attributes, data)
@@ -191,7 +195,8 @@ def send_bluesky_graph_block(self,_firehoseurl : str, _did : str, data: Block, c
191195
"specversion":"1.0",
192196
"type":"Bluesky.Graph.Block",
193197
"source":"{firehoseurl}".format(firehoseurl = _firehoseurl),
194-
"subject":"{did}".format(did = _did)
198+
"subject":"{did}".format(did = _did),
199+
"dataschema":"https://c98acd97-4363-4296-8323-b6ab21e53903.westcentralus.messagingcatalog.azure.net/schemagroups/f043d8c3-32c7-4c3e-8527-d79e0ac996e5/schemas/Bluesky.Graph.Block/versions/v1"
195200
}
196201
attributes["datacontenttype"] = content_type
197202
event = CloudEvent.create(attributes, data)
@@ -224,7 +229,8 @@ def send_bluesky_actor_profile(self,_firehoseurl : str, _did : str, data: Profil
224229
"specversion":"1.0",
225230
"type":"Bluesky.Actor.Profile",
226231
"source":"{firehoseurl}".format(firehoseurl = _firehoseurl),
227-
"subject":"{did}".format(did = _did)
232+
"subject":"{did}".format(did = _did),
233+
"dataschema":"https://c98acd97-4363-4296-8323-b6ab21e53903.westcentralus.messagingcatalog.azure.net/schemagroups/f043d8c3-32c7-4c3e-8527-d79e0ac996e5/schemas/Bluesky.Actor.Profile/versions/v2"
228234
}
229235
attributes["datacontenttype"] = content_type
230236
event = CloudEvent.create(attributes, data)

0 commit comments

Comments
 (0)