Skip to content

Make CloudEvent type constants in AbstractLifeCyclePublisher public #1314

@ricardozanini

Description

@ricardozanini

Problem

The CloudEvent type constants defined in AbstractLifeCyclePublisher are currently private, making them inaccessible to downstream projects that need to reference the official Serverless Workflow CloudEvent types.

private static final String TASK_STARTED = "io.serverlessworkflow.task.started.v1";
private static final String WORKFLOW_STARTED = "io.serverlessworkflow.workflow.started.v1";
// ... etc

Use Case

In Quarkus Flow (a Serverless Workflow implementation), we emit structured logs for workflow lifecycle events. We want to:

  1. Use user-friendly filter keys for configuration (e.g., workflow.instance.faulted, workflow.task.started)
  2. Map those filter keys to the official CloudEvent types when logging (e.g., io.serverlessworkflow.workflow.faulted.v1)

This ensures our logged events align with the CNCF Serverless Workflow specification and are compatible with any tooling that expects standard CloudEvent types.

Currently, we have to duplicate these constants in our codebase because we can't reference them from the SDK:
https://github.com/quarkiverse/quarkus-flow/blob/feat/structured-logging-448/core/runtime/src/main/java/io/quarkiverse/flow/structuredlogging/StructuredLoggingEventTypes.java#L55-L70

Proposed Solution

Make the CloudEvent type constants public static final:

public static final String TASK_STARTED = "io.serverlessworkflow.task.started.v1";
public static final String TASK_COMPLETED = "io.serverlessworkflow.task.completed.v1";
// ... etc

This would allow downstream projects to:

  • Reference the official types directly
  • Avoid duplication and drift
  • Ensure consistency across the ecosystem

Benefits

  • Ecosystem alignment: Projects can reference canonical CloudEvent types
  • No breaking changes: Making private constants public is backwards compatible
  • Better maintainability: Single source of truth for CloudEvent type strings

Alternative Considered

The getLifeCycleTypes() method returns all types as a collection, but doesn't help with individual type mapping.


Happy to submit a PR if this sounds reasonable!

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions