简体   繁体   English

我应该如何在Gentics Mesh中实现带有重复事件的Calendar?

[英]How should I implement a Calendar with reccuring events in Gentics Mesh?

I have a requirement to create shared calendars in a Gentics Mesh application. 我需要在Gentics Mesh应用程序中创建共享日历。
This is the approach I've been working out - 这是我一直在努力的方法-

Create a container node called 'events'. 创建一个名为“事件”的容器节点。 This would represent the 'Calendar'. 这将代表“日历”。
Create a schema for 'event', and add instances of this node type to the events folder. 为“事件”创建模式,然后将此节点类型的实例添加到事件文件夹。
The event schema would contain the name, date/time, location, etc... 事件模式将包含名称,日期/时间,位置等。
A String field called temporalExpression could describe the recurrence. 称为temporalExpression的字符串字段可以描述重复发生。
I could then query all events and iterate over them to determine state like - isOccuring or nextOccurance 然后,我可以查询所有事件并遍历它们以确定状态,例如isOccuringnextOccurance

The problem I have with this approach, is that all the logic would live on the client. 我使用这种方法的问题是所有逻辑都将存在于客户端上。
It seems clumsy and error prone. 看起来笨拙且容易出错。

I'm considering building a proxy/middleware layer that forwards all graph queries to the Mesh server, then provide an additional rest service to handle creating/querying events. 我正在考虑构建一个代理/中间件层,该层将所有图形查询转发到Mesh服务器,然后提供附加的rest服务来处理创建/查询事件。 This would provide an abstraction layer to handle complexity. 这将提供一个抽象层来处理复杂性。

Does this approach sound reasonable? 这种方法听起来合理吗?

I've also thought about using the Google Calendar API, but I don't want Mesh to lose visibility of the events. 我还考虑过使用Google Calendar API,但我不希望Mesh丢失事件的可见性。
If I hook into the Mesh eventBus, maybe that would solve it? 如果我挂接到Mesh eventBus,也许可以解决它? Then the middleware could subscribe to the node events and update the Google calendar accordingly. 然后,中间件可以订阅节点事件并相应地更新Google日历。
My concern with this approach - How does Mesh handle consumers of the events? 我对这种方法的关注-Mesh如何处理事件的使用者?
If I scale my middleware up, would each of them receive the event? 如果我扩大中间件,他们每个人都会收到事件吗? I'd need to be careful about duplication. 我需要注意重复。

I know there is plugin functionality with Mesh, but I think it communicates through the same [http] API as a middleware layer would, so I have the same concern about duplication. 我知道Mesh具有插件功能,但我认为它通过与中间件层相同的[http] API进行通信,因此我对复制有同样的担忧。

Thoughts? 思考?

This sounds like a good use case for a Mesh Plugin. 这听起来像是网格插件的好用例。 With the plugin API you have access to the Vert.x instance that Mesh uses. 使用插件API,您可以访问Mesh使用的Vert.x实例。 With that you can access the Eventbus and use the localConsumer to consume the event only on the Mesh instance where the event was fired. 这样,您可以访问Eventbus并使用localConsumer仅在触发事件的Mesh实例上使用事件。 Since the event is only fired on the instance where the calendar entry is initially created, only one consumer will receive the event. 由于仅在最初创建日历项的实例上触发该事件,因此只有一个使用者将收到该事件。 This avoids the duplication, even if you scale up the application. 即使您扩大应用程序,这也可以避免重复。

You can get the address for the Mesh events via the MeshEvent enum. 您可以通过MeshEvent枚举获取Mesh事件的地址。

The plugin API also allows you to add custom endpoints. 插件API还允许您添加自定义端点。 You could easily add endpoints to query the data you mentioned - isOccuring or nextOccurance . 您可以轻松添加端点以查询您提到的数据isOccuringnextOccurance

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM