Get the input data

i have a use case to get the input data with the workflow id.Is there anyway i can do that ?

Also can you provide me the example for using the NonRetryableErrorReasons ?

I have a use case to get the input data with the workflow id.Is there anyway i can do that ?

The simplest way is to create a query that returns the input data.

func MyWorkflow(ctx workflow.Context, input InputData) error {
  err := workflow.SetQueryHandler(ctx, "GetInput", func() (InputData, error) {
    return input, nil
  })
 ...

Also can you provide me the example for using the NonRetryableErrorReasons ?

I don’t think we have a specific sample that covers this. What is problem are you having with the NonRetryableErrorReasons?

i have implemented the NonRetryableErrorReasons by adding specific errors in retry policy.

			MaximumAttempts:    int32(wfMaximumAttempts),
			InitialInterval:    wfInitialInterval,
			MaximumInterval:    wfMaximumInterval,
			BackoffCoefficient: float64(wfBackoffCoefficient),
			NonRetryableErrorTypes:[]string{NOretry},
		}}```

But when i return with same error with the activity, activities still retries.

Can you let me know if i am doing anything wrong?

What is the value of error type in the list of pending activities in the workflow summary view?

the value is
no_retry

The simplest way is to create a query that returns the input data.

func MyWorkflow(ctx workflow.Context, input InputData) error {
  err := workflow.SetQueryHandler(ctx, "GetInput", func() (InputData, error) {
    return input, nil
  })
 ...

Is there any way i can get the input using the client ?

I believe “no_retry” is the message. What is the error type? Could you open up the error box?

type is string.

Then you have to put “string” as NonRetryableErrorType. The type is the actual Go type of the error instance.

I recommend returning an error created through temporal.NewApplicationError which allows specifying the type explicitly.

Another option is to return an error created through temporal.NewNonRetryableApplicationError which is not retried even if the error type is not specified in the NonRetryableErrorTypes.

Retry thing worked Thanks.

The simplest way is to create a query that returns the input data.

func MyWorkflow(ctx workflow.Context, input InputData) error {
  err := workflow.SetQueryHandler(ctx, "GetInput", func() (InputData, error) {
    return input, nil
  })
 ...

Is there any way i can get the input using the client ?

You can query the workflow using the client.

You can also load the first event of the workflow history using getWorkflowExecutionHistory and then deserialize the input arguments out of it. But it is too low level to my taste.

that works. Thank you very much.

Is there any way that i can update the InputData from inside the activity ?

Is there any way that i can update the InputData from inside the activity ?

Activity can return any data and then workflow can update any variable based on the activity result.

really appreciate for your help.it worked!