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

Handle pubsub messages in multi instance scenario #105

Closed
cheungpat opened this issue Aug 3, 2016 · 3 comments
Closed

Handle pubsub messages in multi instance scenario #105

cheungpat opened this issue Aug 3, 2016 · 3 comments

Comments

@cheungpat
Copy link
Contributor

To fix #91, we have to handle how pubsub messages are routed to the client. To solve this, the leader instance will be asked to keep pubsub connections for all clients. Pubsub generated from other instances should forward pubsub messages to the leader instance.

Tasks:

  • add new configuration envvar for specifying the leader pubsub URL
  • forward pubsub messages generated from the instance to the leader (which includes subscriptions and cloudcode-generated messages)
  • leader should be aware that the messages coming from the non-leaders are generated server side and not generated client side
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 1, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 1, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 2, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 2, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 2, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 2, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
cheungpat added a commit to cheungpat/skygear-server that referenced this issue Sep 2, 2016
Subscriptions and pubsub router will be run by skygear server in
leader mode. Cloudcode should connect to leader by configuring
the PUBSUB_URL environment variable.

refs SkygearIO#105
rickmak added a commit that referenced this issue Sep 2, 2016
@rickmak
Copy link
Member

rickmak commented Sep 30, 2016

Revisiting this issue, in #127 we added the configuration on slave and disabled the whole pubsub and cron feature at slave mode.

So the do @cheungpat think following two feature are still meaningful to implement

  • forward pubsub messages generated from the instance to the leader (which includes subscriptions and cloudcode-generated messages)
  • leader should be aware that the messages coming from the non-leaders are generated server side and not generated client side

Or better tol provide a deployment example on how to route the traffic correctly using the program like nginx?

@cheungpat
Copy link
Contributor Author

@rickmak Thanks for bringing it to my attention.

I think the feature is complete in skygear-server and py-skygear to support multiple instances. Agree that we should have deployment example. Where to put it?

forward pubsub messages generated from the instance to the leader (which includes subscriptions and cloudcode-generated messages)

Cloudcode generated messages are forwarded to leader using PUBSUB_URL. In slave mode, skygear-server does not generate notifications for subscriptions

leader should be aware that the messages coming from the non-leaders are generated server side and not generated client side

This is just a reminder not to cause infinite loop forwarding notifications among multiple instances. Since only the leader will act as pubsub hub. This is a non-issue.

@rickmak
Copy link
Member

rickmak commented Oct 3, 2016

Let put the example here: https://github.com/skygear-demo/multiple-server

@rickmak rickmak closed this as completed Oct 3, 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

2 participants