faust.app.router

Route messages to Faust nodes by partitioning.

class faust.app.router.Router(app: faust.types.app.AppT) → None[source]

Router for app.router.

key_store(table_name: str, key: Union[bytes, faust.types.core._ModelT, Any, None]) → yarl.URL[source]

Return the URL of web server that hosts key in table.

Return type

URL

table_metadata(table_name: str) → MutableMapping[str, MutableMapping[str, List[int]]][source]

Return metadata stored for table in the partition assignor.

Return type

MutableMapping[str, MutableMapping[str, List[int]]]

tables_metadata() → MutableMapping[str, MutableMapping[str, List[int]]][source]

Return metadata stored for all tables in the partition assignor.

Return type

MutableMapping[str, MutableMapping[str, List[int]]]

async route_req(table_name: str, key: Union[bytes, faust.types.core._ModelT, Any, None], web: faust.types.web.Web, request: faust.types.web.Request) → faust.types.web.Response[source]

Route request to worker having key in table.

Parameters
  • table_name (str) – Name of the table.

  • key (Union[bytes, _ModelT, Any, None]) – The key that we want.

  • web (Web) – The currently sued web driver,

  • request (Request) – The web request currently being served.

Return type

Response