method Federatable.setActorDispatcher
Federatable.setActorDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`,dispatcher: ActorDispatcher<TContextData>): ActorCallbackSetters<TContextData>Registers an actor dispatcher.
Examples
Example 1
Example 1
federation.setActorDispatcher( "/users/{identifier}", async (ctx, identifier) => { return new Person({ id: ctx.getActorUri(identifier), // ... }); } );
Parameters
path: `${string}${Rfc6570Expression<"identifier">}${string}`The URI path pattern for the actor dispatcher. The syntax is
based on URI Template
(RFC 6570). The path
must have one variable: {identifier}.
dispatcher: ActorDispatcher<TContextData>An actor dispatcher callback to register.
Return Type
ActorCallbackSetters<TContextData>An object with methods to set other actor dispatcher callbacks.
Throws
RouterErrorThrown if the path pattern is invalid.