Skip to content

Enhanced query capabilities on workflow instances #7

Description

@camcima

Summary

Currently findByUuid and findExpired are the only query methods. In practice, teams need richer querying such as "find all instances of workflow X in state Y" or "find all instances with metadata.orderId = Z".

Proposal

Add query capabilities for workflow instances. Options include:

  • findByWorkflowAndState(workflowName, state) — find all instances in a given state
  • findByMetadata(key, value) — query by metadata fields (leveraging PostgreSQL JSONB indexing)
  • A lightweight query builder for composable filters
  • Pagination support for large result sets

Benefits

  • Enables operational dashboards and admin tooling
  • Supports business queries like "show all orders stuck in payment_pending"
  • Leverages PostgreSQL's JSONB indexing capabilities for metadata queries
  • Common requirement for production workflow systems

Considerations

  • Query performance and indexing strategy (GIN indexes on JSONB columns)
  • Whether to expose raw SQL or provide a typed query API
  • Pagination and cursor-based iteration for large result sets
  • Whether to support ordering (by creation date, last transition, etc.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions