8 An API for the manager

This chapter covers

  • Understanding the purpose of the manager API
  • Implementing methods to handle API requests
  • Creating a server to listen for API requests
  • Starting, stopping, and listing tasks via the API

In chapter 7, we implemented the core functionality of the manager component: pulling tasks off its queue, selecting a worker to run those tasks, sending them to the selected workers, and periodically updating the state of tasks. That functionality is just the foundation and doesn’t provide a simple way for users to interact with the manager.

So, like we did with the worker in chapter 5, we’re going to build an API for the manager. This API wraps the manager’s core functionality and exposes it to users. In the case ...

Get Build an Orchestrator in Go (From Scratch) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.