Last active
March 24, 2023 13:44
-
-
Save PatrikValkovic/57deaacade44ff6dfbffe09ad2577211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const handler = async (event: SQSEvent) => { | |
const body = JSON.parse(event.body); | |
const subscriptions = await subscriptionRepository.getByRoutingKey(body.routingKey); | |
for(subscription of subscriptions) { | |
const document = parse(subscription.subscription); | |
const subscriptionResult = await subscribe({ | |
schema, | |
document, | |
variableValues: subscription.variables, | |
contextValue: contextDeserializer(subscription.context), | |
}); | |
do { | |
const next = await result.next(); | |
await client.send(subscription.connectionId, next.value); | |
} while (!next.done); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment