googleapis / nodejs-pubsub

Node.js client for Google Cloud Pub/Sub: Ingest event streams from anywhere, at any scale, for simple, reliable, real-time stream analytics.
https://cloud.google.com/pubsub/
Apache License 2.0
517 stars 227 forks source link

Unable to consume cross-project AVRO messages #1910

Closed thomasvargiu closed 5 months ago

thomasvargiu commented 5 months ago

Hi,

Currently it's possibile to subscribe to a topic from a different project, but it's not possible to consume messages when them are serialized with AVRO because we are unable to get the writer schema from the full name in the googclient_schemaname attribute.

thomasvargiu commented 5 months ago

Ok, I probably found a solution using the SchemaClient:


const client = await pubsub.getSchemaClient()
const [schema] = await client.getSchema({
    name: 'projects/project-id/schemas/schema-id',
    view: 'FULL',
})
```