简体   繁体   中英

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.
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.
I could then query all events and iterate over them to determine state like - isOccuring or nextOccurance

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. 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.
If I hook into the Mesh eventBus, maybe that would solve it? Then the middleware could subscribe to the node events and update the Google calendar accordingly.
My concern with this approach - How does Mesh handle consumers of the events?
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.

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. 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. 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.

The plugin API also allows you to add custom endpoints. You could easily add endpoints to query the data you mentioned - isOccuring or nextOccurance .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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