Skip to content

[Feature Request] Expose UpdateID in an update handler #293

@Quinn-With-Two-Ns

Description

@Quinn-With-Two-Ns

Is your feature request related to a problem? Please describe.

Add a way for users to obtain an update requests UpdateID in a handler.

Describe the solution you'd like

In Go I would implement it through Info call like GetUpdateInfo

func Counter(ctx workflow.Context) (int, error) {
	log := workflow.GetLogger(ctx)
	counter := 0

	if err := workflow.SetUpdateHandlerWithOptions(
		ctx,
		FetchAndAdd,
		func(ctx workflow.Context, i int) (int, error) {
                        updateID := workflow.GetUpdateInfo(ctx).UpdateID
			tmp := counter
			counter += i
			log.Info("counter updated", "addend", i, "new-value", counter, "update ID", updateID)
			return tmp, nil
		},
		workflow.UpdateHandlerOptions{Validator: nonNegative},
	); err != nil {
		return 0, err
	}

Additional context

We should also consider adding UpdateID to the interceptors as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions