An object that registers federation-related business logic and dispatches requests to the appropriate handlers.
It also provides a middleware interface for handling requests before your web framework's router; see Federation.fetch.
The context data to pass to the Context.
startQueue(contextData: TContextData,options?: FederationStartQueueOptions,): Promise<void>
Manually start the task queue.
This method is useful when you set the manuallyStartQueue
option to
true
in the createFederation function.
processQueuedTask(contextData: TContextData,message: Message,): Promise<void>
Processes a queued message task. This method handles different types of tasks such as fanout, outbox, and inbox messages.
Note that you usually do not need to call this method directly unless you are deploying your federated application on a platform that does not support long-running processing, such as Cloudflare Workers.
createContext(baseUrl: URL,contextData: TContextData,): Context<TContextData>
Create a new context.
createContext(request: Request,contextData: TContextData,): RequestContext<TContextData>
Create a new context for a request.
fetch(request: Request,options: FederationFetchOptions<TContextData>,): Promise<Response>
Handles a request related to federation. If a request is not related to
federation, the onNotFound
or onNotAcceptable
callback is called.
Usually, this method is called from a server's request handler or a web framework's middleware.