As a part of T39902 we need to support rerendering pages which link to the new page after a new page is created. I've been battling with supporting this in change-propagation for some time, and here's a plan I've came up with:
- There will be a rule subscribed to revision_create topic, with a test for rev_parent_id being null - this means new created pages.
- The executor for this rule will post a request to MW API getting all the backlinks, the executor should be a full-blown request handler, not just a template.
- NEW FEATURE: Export handlerTemplate from HyperSwitch
- NEW FEATURE: Add support for handlerTemplate in change propagation.
- Upon receiving a list of items, we need to do a foreach over items and post a resource_change event for each item.
- NEW FEATURE: Add support of a foreach keyword in handler template. Syntactically it could look like [1]
- NEW FEATURE: Add support for posting events within change propagation from a rule exec template. It's questionable whether we want to post an event directly or if we better go through the eventlogging-service. Pros of the former is that it's faster and creates way less load on the eventlogging-service (and the load here may be quite high as the same mechanism will likely be applied for template updates). Also with direct producing we can post events to change-prop internal topics like retry queues etc. Pros for the latter is that we get event validation.
- Each resource_change is processed normally by a rule that would be set up for rerenders on MW purge and null_edit
- Last required piece is to support continue. Several options are possible:
- Set up an endpoint that supports continuation within a kafka module. Then a final step of the handler template would issue a request to the continuation service with details of the message and continue property received from MW API. The module would emit an event to a special internal continuation topics (it could be combined with a retry topic, just a message would have a different envelope).
- Add general support for 100 HTTP status response. If the handler returned 100 with some body identifying the continue - post a message to the continuation topic.
- NEW FEATURE: Add support for continuation.
[1] Example syntax for foreach in handler templates:
- process_all_items:
foreach: '{{result.body.items}}'
request:
uri: '/{{item.name}}'@GWicke @mobrovac @Eevans What do you think about this approach?