1

I'm running an Absinthe GraphQL server which queries a backend, but there are also events coming in from outside (over AMQP), indicating an update has happened (some of which do not include the updated record info).

I can handle the events that include the new record with Absinthe.Subscription.publish.

But how do I handle the cases where the updated record is not present?

In other words, I would like to trigger Absinthe to issue a query, and send the result to the GraphQL client as the result of an existing subscription.

raarts
  • 2,711
  • 4
  • 25
  • 45
  • What exactly do you mean by 'the updated record is not present', does it mean that you don't know what attributes of the record were updated? If you have the id of the updated record, you could just query and return (publish) the whole record. – zwippie Mar 01 '18 at 17:06
  • Right, that's what I meant. The problem is, in this case I do not know the user credentials so I cannot filter the data according to the user's permissions – raarts Mar 01 '18 at 17:08
  • I see, well then perhaps it makes sense to switch from a global subscription topic (notify updates for *any* record) to individual subscriptions for each individual record. Create separate rooms in the subscription channel for every individual record (by setting the room's topic to `record:`) and perform authorization when the room is joined. No idea how this will scale/perform with millions of records/subscriptions though. – zwippie Mar 01 '18 at 18:27

0 Answers0