Overview
A resource catalog is an external collection of reusable components, such as functions, that can be referenced and imported into workflows. The primary purpose of catalogs is to allow workflows to seamlessly integrate with externally defined resources, facilitating better reuse, versioning, and consistency across multiple workflows. Each catalog is defined by anendpoint property that specifies the root URL where the resources are hosted. This enables workflows to access external functions and services from those catalogs.
File Structure
To ensure portability and standardization, catalogs must follow a specific file structure, which is documented here. This file structure ensures that runtimes can correctly interpret and resolve the resources contained within a catalog.GitHub and GitLab Resolution
If a catalog is hosted in a GitHub or GitLab repository, runtimes are expected to resolve the raw machine-readable documents that define the cataloged resources. For example, for the functionlog:1.0.0 located in a catalog at https://github.com/serverlessworkflow/catalog/tree/main, the function definition URI:
Default Catalog
Runtimes may optionally define a “default” catalog, which can be used implicitly by any and all workflows, unlike other catalogs which must be explicitly defined at the top level. The default catalog provides authors with a way to define and publish functions directly to their runtime, without any additional overhead or external dependencies. When using the default catalog, users follow the same format as described above, but with the reserved namedefault for the catalog:
The name
default should not be used by catalogs explicitly defined at the top level, unless the intent is to override the runtime’s default catalog.- In a database
- As files
- In configuration settings
- Within a remote dedicated repository
Using Cataloged Functions
When calling a custom function defined in a catalog, users must follow a specific format:Example: Calling a Cataloged Function
Frequently Asked Questions
What is the difference between a catalog and external resources?
What is the difference between a catalog and external resources?
Catalogs are collections of reusable components (like functions) that follow a standardized structure and can be versioned. External resources are specific assets or services (APIs, databases, files) needed by a workflow. Catalogs promote reuse across workflows, while external resources are dependencies for a specific workflow.
Can I use multiple catalogs in a single workflow?
Can I use multiple catalogs in a single workflow?
Yes! You can define multiple catalogs in the
use.catalogs section of your workflow. Each catalog must have a unique name, and you reference functions from different catalogs using the {functionName}:{version}@{catalogName} format.How do I version functions in a catalog?
How do I version functions in a catalog?
Functions in catalogs should include semantic versioning in their path structure, such as
/functions/my-function/1.0.0/function.yaml. When calling the function, you specify the version: my-function:1.0.0@catalog-name.What happens if a cataloged function cannot be found?
What happens if a cataloged function cannot be found?
If a runtime cannot resolve a cataloged function (due to network issues, incorrect path, or missing resources), it will raise an error and the workflow execution will fault. Ensure catalog endpoints are accessible and function paths are correct.