Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow execution if the SQL Persistence is enabled #1320

Closed
MGrgov90 opened this issue Nov 20, 2024 · 3 comments
Closed

Workflow execution if the SQL Persistence is enabled #1320

MGrgov90 opened this issue Nov 20, 2024 · 3 comments

Comments

@MGrgov90
Copy link

MGrgov90 commented Nov 20, 2024

I have a Workflow that consists 3 steps.

public class FinishedProductWorkflow : IWorkflow<FinishedProductWorkflowData>
{
    public string Id => "FinishedProductWorkflow";

    public int Version => 1;

    public void Build(IWorkflowBuilder<FinishedProductWorkflowData> builder)
    {
        builder.StartWith<CreateFinishedProduct>()
            .Then<UpdateFinishedProductTraceability>()
            .Then<PublishFinishedProduct>()
            .EndWorkflow();
    }
}

each step implements IStepBody interface. For example:

public class PublishFinishedProduct : IStepBody
{
    //attributes and ctor
    //...

    public async Task<ExecutionResult> RunAsync(IStepExecutionContext context)
    {
        //getting data from the context
        var data = context.Workflow.Data as FinishedProductWorkflowData;

        //some logic that needs to be executed
        //...
        return ExecutionResult.Next();
    }
}

I have a problem when I switch from the default persistence provider to the SQL Server.

//services.AddWorkflow();
services.AddWorkflow(cfg =>
{
    cfg.UseSqlServer(_configuration.GetSection("DatabaseOptions:ConnectionString").Value, true, true);
});

All the tables are created and a workflow seems to be started. I can find rows inside the database for the particular workflow execution.
I have:

  • Row inside the Workflow table with Data attribute populated with correct data.
  • Row inside the ExecutionPointer table that is pointing to the correct row in the Workflow table and the step is the first step in my workflow (CreateFinishedProduct)
  • ExecutionError table is empty

My workflow is started by hitting a dedicated endpoint like this:

var data = new FinishedProductWorkflowData()
{
    FinishedProduct = finishedProductResult.Value,
};
var workflowId = await _workflowHost.StartWorkflow("FinishedProductWorkflow", 1, data);

But the steps are not executed !
I can't debug them, also I can't find any record that shows me the execution inside the database.

Everything works with the default persistence provider

Any help?

@danielgerlag
Copy link
Owner

Did you start the workflow host?

@MGrgov90
Copy link
Author

My data class FinishedProductWorkflowData contains the complex object FinishedProduct

public class FinishedProductWorkflowData
{
    public FinishedProduct FinishedProduct { get; set; }
    public Guid FinishedProductId { get; set; }
    public Guid TraceabilityBlockId { get; set; }
}

and my FinishedProduct class did not have the default constructor. After adding the default private constructor, everything works well.

@MGrgov90
Copy link
Author

My data class FinishedProductWorkflowData contains the complex object FinishedProduct

public class FinishedProductWorkflowData
{
    public FinishedProduct FinishedProduct { get; set; }
    public Guid FinishedProductId { get; set; }
    public Guid TraceabilityBlockId { get; set; }
}

and my FinishedProduct class did not have the default constructor. After adding the default private constructor, everything works well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants