Skip to content

Commit

Permalink
Configure alternate backend for Dapr workflow (#7283)
Browse files Browse the repository at this point in the history
* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Update pkg/runtime/runtime.go

Co-authored-by: Chris Gillum <cgillum@gmail.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>

* Configurable workflow backend

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Adding e2e tests for sqlite

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Create workflow backend component

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* perf test build issue

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Add perf test for sqlite backend

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Moving component-contrib changes to dapr/dapr

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Moving component-contrib changes to dapr/dapr

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Initialize dtf-go backen in the dtf-go library

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Initialize dtf-go backen in the dtf-go library

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Initialize dtf-go backen in the dtf-go library

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Initialize dtf-go backend in dapr itself

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* remove visual studio solution file

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* remove visual studio solution file

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* rename wbe to wfbe

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* renaming backend file to actor_backend

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix link error

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update pkg/runtime/wfengine/wfengine_backend_test.go

Co-authored-by: Chris Gillum <cgillum@gmail.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Add workflow backend

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Fixed workflow backend ready issue

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* modifying perf test to run only for one backed at a time, by default run actor backend

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* modifying perf test to run only for one backed at a time, by default run actor backend

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Added unit test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Added unit test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Added unit test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Added unit test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* moving sqlite to its own component file

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* add map structure for sqlite options

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* add map structure for sqlite options

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Implemented workflow backend drop in

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fixed lint error

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update cmd/daprd/components/wfbackend_actor.go

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update pkg/runtime/wfengine/sqlite_backend.go

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update pkg/runtime/wfengine/sqlite_backend.go

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fixed review comments

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fixed review comments

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fixed review comments

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fixed unit tests

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update pkg/components/wfbackend/metadata.go

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update pkg/components/wfbackend/registry.go

Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Remove space from log messsages

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* return error on backend component parsing failure

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* WIP: Ensure backends can be loaded via drop-in

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Various fixes

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* Various fixes

Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>

* removing duplicate actors variable

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix merge conflict

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix merge conflict

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* commenting monitor test to check if thats creating issue with e2e test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* commenting monitor test to check if thats creating issue with e2e test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* run only sqlite test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix wf backend test

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Update Dockerfile

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* making sqlite backend only available for unit/e2e/integration/perf tests and local development

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* making sqlite backend only available for unit/e2e/integration/perf tests and local development

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* making sqlite backend only available for unit/e2e/integration/perf tests and local development

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* fix merge conflict

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* Change build tag to wfbackendsqlite

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

* removing DAPR_GO_BUILD_TAGS=wfbackendsqlite as it will come from https://github.com/dapr/dapr/pull/7373/files

Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>

---------

Signed-off-by: ashiquemd <noorani.ashique5@gmail.com>
Signed-off-by: MD Ashique <noorani.ashique5@gmail.com>
Signed-off-by: ItalyPaleAle <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Chris Gillum <cgillum@gmail.com>
Co-authored-by: Alessandro (Ale) Segala <43508+ItalyPaleAle@users.noreply.github.com>
Co-authored-by: Mukundan Sundararajan <65565396+mukundansundar@users.noreply.github.com>
  • Loading branch information
4 people committed Jan 15, 2024
1 parent 51dc3a1 commit a19902a
Show file tree
Hide file tree
Showing 38 changed files with 1,060 additions and 357 deletions.
1 change: 1 addition & 0 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
# Container registry where to cache e2e test images
DAPR_CACHE_REGISTRY: "dapre2eacr.azurecr.io"
PULL_POLICY: IfNotPresent
DAPR_GO_BUILD_TAGS: wfbackendsqlite
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
Expand Down
5 changes: 4 additions & 1 deletion cmd/daprd/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
pubsubLoader "github.com/dapr/dapr/pkg/components/pubsub"
secretstoresLoader "github.com/dapr/dapr/pkg/components/secretstores"
stateLoader "github.com/dapr/dapr/pkg/components/state"
wfbeLoader "github.com/dapr/dapr/pkg/components/wfbackend"
workflowsLoader "github.com/dapr/dapr/pkg/components/workflows"
"github.com/dapr/dapr/pkg/modes"
"github.com/dapr/dapr/pkg/runtime/registry"
Expand Down Expand Up @@ -92,6 +93,7 @@ func Run() {
nrLoader.DefaultRegistry.Logger = logContrib
bindingsLoader.DefaultRegistry.Logger = logContrib
workflowsLoader.DefaultRegistry.Logger = logContrib
wfbeLoader.DefaultRegistry.Logger = logContrib
httpMiddlewareLoader.DefaultRegistry.Logger = log // Note this uses log on purpose

reg := registry.NewOptions().
Expand All @@ -104,7 +106,8 @@ func Run() {
WithBindings(bindingsLoader.DefaultRegistry).
WithCryptoProviders(cryptoLoader.DefaultRegistry).
WithHTTPMiddlewares(httpMiddlewareLoader.DefaultRegistry).
WithWorkflows(workflowsLoader.DefaultRegistry)
WithWorkflows(workflowsLoader.DefaultRegistry).
WithWorkflowBackends(wfbeLoader.DefaultRegistry)

ctx := signals.Context()
secProvider, err := security.New(ctx, security.Options{
Expand Down
27 changes: 27 additions & 0 deletions cmd/daprd/components/wfbackend_actors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//go:build allcomponents || stablecomponents

/*
Copyright 2023 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package components

import (
wfbeLoader "github.com/dapr/dapr/pkg/components/wfbackend"
"github.com/dapr/dapr/pkg/runtime/wfengine/backends/actors"
)

func init() {
// Note that the actors backend is always enabled, even if this file is deleted
// This component is still registered here to allow users to explicitly instantiate the actors backend
wfbeLoader.DefaultRegistry.RegisterComponent(actors.NewActorBackend, "actor", "actors")
}
25 changes: 25 additions & 0 deletions cmd/daprd/components/wfbackend_sqlite.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build wfbackendsqlite

/*
Copyright 2023 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package components

import (
wfbeLoader "github.com/dapr/dapr/pkg/components/wfbackend"
"github.com/dapr/dapr/pkg/runtime/wfengine/backends/sqlite"
)

func init() {
wfbeLoader.DefaultRegistry.RegisterComponent(sqlite.NewSQLiteBackend, "sqlite")
}
13 changes: 10 additions & 3 deletions pkg/api/http/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import (
"github.com/dapr/dapr/pkg/runtime/channels"
"github.com/dapr/dapr/pkg/runtime/compstore"
runtimePubsub "github.com/dapr/dapr/pkg/runtime/pubsub"
"github.com/dapr/dapr/pkg/runtime/wfengine"
daprt "github.com/dapr/dapr/pkg/testing"
testtrace "github.com/dapr/dapr/pkg/testing/trace"
"github.com/dapr/dapr/utils"
Expand Down Expand Up @@ -2649,11 +2650,17 @@ func TestV1Beta1Workflow(t *testing.T) {
resiliencyConfig := resiliency.FromConfigurations(logger.NewLogger("workflow.test"), testResiliency)
compStore := compstore.New()
compStore.AddWorkflow(componentName, fakeWorkflowComponent)

spec := config.WorkflowSpec{MaxConcurrentWorkflowInvocations: 100, MaxConcurrentActivityInvocations: 100}
wfengine := wfengine.NewWorkflowEngine("testAppID", spec, nil)
wfengine.SetWorkflowEngineReadyDone()

testAPI := &api{
universal: universal.New(universal.Options{
Logger: logger.NewLogger("fakeLogger"),
CompStore: compStore,
Resiliency: resiliencyConfig,
Logger: logger.NewLogger("fakeLogger"),
CompStore: compStore,
Resiliency: resiliencyConfig,
WorkflowEngine: wfengine,
}),
}
testAPI.universal.SetActorsInitDone()
Expand Down
4 changes: 4 additions & 0 deletions pkg/api/universal/universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/dapr/dapr/pkg/config"
"github.com/dapr/dapr/pkg/resiliency"
"github.com/dapr/dapr/pkg/runtime/compstore"
"github.com/dapr/dapr/pkg/runtime/wfengine"
"github.com/dapr/kit/logger"
)

Expand All @@ -37,6 +38,7 @@ type Options struct {
ExtendedMetadata map[string]string
AppConnectionConfig config.AppConnectionConfig
GlobalConfig *config.Configuration
WorkflowEngine *wfengine.WorkflowEngine
}

// Universal contains the implementation of gRPC APIs that are also used by the HTTP server.
Expand All @@ -51,6 +53,7 @@ type Universal struct {
extendedMetadata map[string]string
appConnectionConfig config.AppConnectionConfig
globalConfig *config.Configuration
workflowEngine *wfengine.WorkflowEngine

extendedMetadataLock sync.RWMutex
actorsLock sync.RWMutex
Expand All @@ -70,6 +73,7 @@ func New(opts Options) *Universal {
extendedMetadata: opts.ExtendedMetadata,
appConnectionConfig: opts.AppConnectionConfig,
globalConfig: opts.GlobalConfig,
workflowEngine: opts.WorkflowEngine,
actorsReadyCh: make(chan struct{}),
}
}
Expand Down
21 changes: 7 additions & 14 deletions pkg/api/universal/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ func (a *Universal) GetWorkflowBeta1(ctx context.Context, in *runtimev1pb.GetWor
return &runtimev1pb.GetWorkflowResponse{}, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand Down Expand Up @@ -81,8 +80,7 @@ func (a *Universal) StartWorkflowBeta1(ctx context.Context, in *runtimev1pb.Star
return &runtimev1pb.StartWorkflowResponse{}, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand Down Expand Up @@ -117,8 +115,7 @@ func (a *Universal) TerminateWorkflowBeta1(ctx context.Context, in *runtimev1pb.
return emptyResponse, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand Down Expand Up @@ -155,8 +152,7 @@ func (a *Universal) RaiseEventWorkflowBeta1(ctx context.Context, in *runtimev1pb
return emptyResponse, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand Down Expand Up @@ -187,8 +183,7 @@ func (a *Universal) PauseWorkflowBeta1(ctx context.Context, in *runtimev1pb.Paus
return emptyResponse, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand All @@ -215,8 +210,7 @@ func (a *Universal) ResumeWorkflowBeta1(ctx context.Context, in *runtimev1pb.Res
return emptyResponse, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand All @@ -243,8 +237,7 @@ func (a *Universal) PurgeWorkflowBeta1(ctx context.Context, in *runtimev1pb.Purg
return emptyResponse, err
}

// Workflow requires actors to be ready
a.WaitForActorsReady(ctx)
a.workflowEngine.WaitForWorkflowEngineReady(ctx)

workflowComponent, err := a.getWorkflowComponent(in.GetWorkflowComponent())
if err != nil {
Expand Down
63 changes: 39 additions & 24 deletions pkg/api/universal/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ import (
"github.com/stretchr/testify/require"

"github.com/dapr/components-contrib/workflows"
"github.com/dapr/dapr/pkg/config"
"github.com/dapr/dapr/pkg/messages"
runtimev1pb "github.com/dapr/dapr/pkg/proto/runtime/v1"
"github.com/dapr/dapr/pkg/resiliency"
"github.com/dapr/dapr/pkg/runtime/compstore"
"github.com/dapr/dapr/pkg/runtime/wfengine"
daprt "github.com/dapr/dapr/pkg/testing"
"github.com/dapr/kit/logger"
)
Expand Down Expand Up @@ -111,10 +113,11 @@ func TestStartWorkflowBeta1API(t *testing.T) {

// Setup universal dapr API
fakeAPI := &Universal{
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
workflowEngine: getWorkflowEngine(),
}
fakeAPI.SetActorsInitDone()

Expand Down Expand Up @@ -185,10 +188,11 @@ func TestGetWorkflowBeta1API(t *testing.T) {

// Setup universal dapr API
fakeAPI := &Universal{
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
workflowEngine: getWorkflowEngine(),
}
fakeAPI.SetActorsInitDone()

Expand Down Expand Up @@ -258,10 +262,11 @@ func TestTerminateWorkflowBeta1API(t *testing.T) {

// Setup universal dapr API
fakeAPI := &Universal{
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
workflowEngine: getWorkflowEngine(),
}
fakeAPI.SetActorsInitDone()

Expand Down Expand Up @@ -346,10 +351,11 @@ func TestRaiseEventWorkflowBeta1Api(t *testing.T) {

// Setup universal dapr API
fakeAPI := &Universal{
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
workflowEngine: getWorkflowEngine(),
}
fakeAPI.SetActorsInitDone()

Expand Down Expand Up @@ -421,10 +427,11 @@ func TestPauseWorkflowBeta1Api(t *testing.T) {

// Setup universal dapr API
fakeAPI := &Universal{
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
workflowEngine: getWorkflowEngine(),
}
fakeAPI.SetActorsInitDone()

Expand Down Expand Up @@ -494,10 +501,11 @@ func TestResumeWorkflowBeta1Api(t *testing.T) {

// Setup universal dapr API
fakeAPI := &Universal{
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
logger: logger.NewLogger("test"),
resiliency: resiliency.New(nil),
compStore: compStore,
actorsReadyCh: make(chan struct{}),
workflowEngine: getWorkflowEngine(),
}
fakeAPI.SetActorsInitDone()

Expand All @@ -517,3 +525,10 @@ func TestResumeWorkflowBeta1Api(t *testing.T) {
})
}
}

func getWorkflowEngine() *wfengine.WorkflowEngine {
spec := config.WorkflowSpec{MaxConcurrentWorkflowInvocations: 100, MaxConcurrentActivityInvocations: 100}
wfengine := wfengine.NewWorkflowEngine("testAppID", spec, nil)
wfengine.SetWorkflowEngineReadyDone()
return wfengine
}
21 changes: 11 additions & 10 deletions pkg/components/category.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ type Category string

// supported components category
const (
CategoryBindings Category = "bindings"
CategoryPubSub Category = "pubsub"
CategorySecretStore Category = "secretstores"
CategoryStateStore Category = "state"
CategoryWorkflow Category = "workflow"
CategoryMiddleware Category = "middleware"
CategoryConfiguration Category = "configuration"
CategoryCryptoProvider Category = "crypto"
CategoryLock Category = "lock"
CategoryNameResolution Category = "nameresolution"
CategoryBindings Category = "bindings"
CategoryPubSub Category = "pubsub"
CategorySecretStore Category = "secretstores"
CategoryStateStore Category = "state"
CategoryWorkflow Category = "workflow"
CategoryWorkflowBackend Category = "workflowbackend"
CategoryMiddleware Category = "middleware"
CategoryConfiguration Category = "configuration"
CategoryCryptoProvider Category = "crypto"
CategoryLock Category = "lock"
CategoryNameResolution Category = "nameresolution"
)
26 changes: 26 additions & 0 deletions pkg/components/wfbackend/metadata.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2023 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package wfbackend

import (
"github.com/dapr/components-contrib/metadata"
)

// Metadata represents a set of properties specific for workflow backends.
type Metadata struct {
metadata.Base `json:",inline"`

// Dapr app ID
AppID string
}

0 comments on commit a19902a

Please sign in to comment.