Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

Add lifecycle event to plugin #199

Closed
9 tasks done
rickmak opened this issue Oct 26, 2016 · 0 comments
Closed
9 tasks done

Add lifecycle event to plugin #199

rickmak opened this issue Oct 26, 2016 · 0 comments
Assignees

Comments

@rickmak
Copy link
Member

rickmak commented Oct 26, 2016

This document describe Skygear plugin event design

Principle

  • Plugin is a stateless process to handle request
  • Plugin event is not binding to network or RPC concept.
  • Plugin event is not binding transport, whether zmq, http or exec
  • Life cycle is refer to Skygear life cycle. All events are sent from server
    to plugin.

How the message is sent

  • It will send to the registered plugin, synchronously.
  • All life cycle event will be sent once to the plugin. Regardless of how many
    actual workers or server that the plugin is actually running.

Life cycle event

In order, only call once on Skygear server boot up.
This mean, a plugin instance will receives multiple Pre-conifig if the Skygear
server is restart but plugin is not.

  1. Before-config ("Before-config")

    • Before the Skygear querying the configuration of plugin.
    • Use case: Additional debug handler according to envvar
  2. After-config ("after-config")

    • After all plugin configuration is acquired.
    • Use case: Issue direct pq migration for action like create table
  3. Before Plugins Ready ("before-plugins-ready")

    • Use case: Issue schema:create change. Create the column assumed exist by
      this plugin.
  4. All plugins Ready ("after-plugins-ready")

    • This phase all plugin already registered and DB hook are working. But
      still reject client API call.
    • Use case: For seed data, issue record save that rely on the plugin hook.
  5. Server Ready ("server-ready")

    • On server complete the boot up sequence. Start to accept API call from
      client.
    • Use case: Send reboot logs to sentry.

Non life cycle event

  • Schema Changed
    • When the Skygear server received schema:* call.
    • Use case: invalided cached DB schmea or ORM session.

Plugin to plugin event

  • Skygear will just act as a pubsub hub that route the event between plugin.

Tasks

  • Support send events via exec, http and zmq transport
  • Merge plugin init as an event init
  • Implement lifecycle-related events
    • Before plugin configuration before-config
    • After plugin configuration after-config
    • Before Plugins Ready before-plugins-ready
    • After Plugins Ready after-plugins-ready
    • Server Ready server-ready
  • Implement non lifecycle-related events
    • Schema Changed - schema-changed
  • Update documentation
@royuen royuen added Focus and removed This Sprint labels Oct 31, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 1, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 2, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 3, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 3, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 3, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 3, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 4, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 4, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 4, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-server that referenced this issue Nov 7, 2016
cheungpat added a commit that referenced this issue Nov 7, 2016
cheungpat added a commit that referenced this issue Nov 7, 2016
ben181231 pushed a commit to ben181231/skygear-doc that referenced this issue Nov 8, 2016
ben181231 pushed a commit to ben181231/skygear-doc that referenced this issue Nov 8, 2016
ben181231 pushed a commit to ben181231/skygear-doc that referenced this issue Nov 9, 2016
bensonby pushed a commit to SkygearIO/skygear-doc that referenced this issue Nov 9, 2016
@rickmak rickmak closed this as completed Nov 9, 2016
@rickmak rickmak removed the In Review label Nov 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants