Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Inbox, a new API to manage communication with workers #1010

Draft
wants to merge 1 commit into
base: jazz-91-writer-only-permission-kind
Choose a base branch
from

Conversation

gdorsi
Copy link
Contributor

@gdorsi gdorsi commented Dec 12, 2024

The idea is to provide an easy-to-use API to reliabily send messages to workers.

I've currently added:

  • A jazz-run command to create an Inbox. It returns the "tickets" that can be used to use the inbox
  • An integration with jazz-nodejs. By providing a ticket and a callback the user is notified of any new message coming into the Inbox

A quick summary of how it will look:

  • Setup the inbox by running npx jazz-run inbox create. It's meant to be managed using env vars. In the future we will give a WebUI to manage this kind of stuff using a simple login command.
  • On the worker side it will be something like this:
const { worker, done } = await startWorker({ 
   inboxTicket: 'xxxx', 
   onInboxMessage: async (id: ID<BriscolaGame>) => {
      const game = await BriscolaGame.load(id, worker);
      
      startGameLoop(game);
   }
}) 

What I still need to figure out:

  • Does the current implementation work? (haven't tested it yet)
  • Design how the API is consumed on the client side (guess that's going to be just a pushMessage API)
  • How can we scale to an infinite amount of messages?
  • How's going to be possible to distribute work across workers? (might steal the sharding approach from Implement ShardedPeer #763 or go for something like Raft)

Copy link

vercel bot commented Dec 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
books-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
clerk-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
form-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
gcmp-homepage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
image-upload-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
jazz-chat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
jazz-chat-1 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
jazz-chat-2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
jazz-homepage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
jazz-pets ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
jazz-todo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
music-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
passkey-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
passwords-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
reactions-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 13, 2024 0:27am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
jazz-inspector ⬜️ Skipped (Inspect) Dec 13, 2024 0:27am

@gdorsi gdorsi force-pushed the jazz-93-inbox-abstraction branch from 56be9ca to 9fbf22d Compare December 12, 2024 16:12
@gdorsi gdorsi force-pushed the jazz-93-inbox-abstraction branch from 9118eb3 to 364de15 Compare December 13, 2024 12:20
@vercel vercel bot temporarily deployed to Preview – jazz-inspector December 13, 2024 12:20 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant