在AWS AppSync中对订阅进行自定义过滤 [英] Custom filtering on subscription in AWS AppSync

查看:119
本文介绍了在AWS AppSync中对订阅进行自定义过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在AWS AppSync的订阅中具有自定义过滤逻辑?

Is it possible to have custom filtering logic on subscription in AWS AppSync?

据我所知,当前行为是: 例如我的架构如下所示

As I know, current behavior is: e.g. my schema is like the following

type Mutation {
  createEvent(userId: ID!, event: Event!): Event!
}

type Subscription {
  onEvent(userId: ID!): Event!
  @aws_subscribe(mutations: ["createEvent"])
}

AppSync的当前行为是,当我触发createEvent时,Appsync承诺如果userId相等,则订阅的订阅者会收到该事件. 即AppSync的过滤逻辑就像

Current behavior of AppSync is, when I trigger createEvent, AppSync promise that the subscriber of Subscription receive the Event if the userId are equal. i.e. the filtering logic of AppSync is sth like

if (Muatation.userId == Subscription.userId) {
  // forward to subscriber
}

但是,如果我想要不同的过滤逻辑怎么办? 例如,我想预订除我触发的事件以外的所有其他事件? 即

But what if I want different filtering logic? For example, I want to subscribe all other events except those triggered by me? i.e.

if (Muatation.userId != Subscription.userId) {
  // forward to subscriber
}

那么,AppSync中是否可以具有自定义过滤逻辑?

So, is it possible to have custom filtering logic in AppSync?

推荐答案

当前,AppSync不支持此用例.

Currently, this use case is not supported by AppSync.

将来可能会考虑添加自定义过滤.

Adding custom filtering may be considered in the future.

这篇关于在AWS AppSync中对订阅进行自定义过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆