Initial creation of workflows building block
Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com>
This commit is contained in:
parent
63c547f1ad
commit
9ba415b893
|
|
@ -17,7 +17,10 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
<<<<<<< HEAD
|
||||
"github.com/zouyx/agollo/v3/component/log"
|
||||
=======
|
||||
>>>>>>> Initial creation of workflows building block
|
||||
"go.temporal.io/sdk/activity"
|
||||
"go.temporal.io/sdk/client"
|
||||
"go.temporal.io/sdk/worker"
|
||||
|
|
@ -36,7 +39,10 @@ func main() {
|
|||
// Create the workflow client
|
||||
clientTwo, err := client.Dial(cOpt)
|
||||
if err != nil {
|
||||
<<<<<<< HEAD
|
||||
log.Error("Unable to create client.")
|
||||
=======
|
||||
>>>>>>> Initial creation of workflows building block
|
||||
return
|
||||
}
|
||||
wOpt := worker.Options{}
|
||||
|
|
@ -49,7 +55,10 @@ func main() {
|
|||
|
||||
err = w.Start()
|
||||
if err != nil {
|
||||
<<<<<<< HEAD
|
||||
log.Error("Unable to start worker.")
|
||||
=======
|
||||
>>>>>>> Initial creation of workflows building block
|
||||
return
|
||||
}
|
||||
w.Run(worker.InterruptCh())
|
||||
|
|
@ -66,9 +75,15 @@ func TestWorkflow(ctx workflow.Context, runtimeSeconds int) error {
|
|||
}
|
||||
|
||||
ctx = workflow.WithActivityOptions(ctx, options)
|
||||
<<<<<<< HEAD
|
||||
err := workflow.ExecuteActivity(ctx, ExampleActivity, runtimeSeconds).Get(ctx, nil)
|
||||
if err != nil {
|
||||
log.Error("Unable to execute activity.")
|
||||
=======
|
||||
newCtx, _ := workflow.NewDisconnectedContext(ctx)
|
||||
err := workflow.ExecuteActivity(newCtx, ExampleActivity, runtimeSeconds).Get(ctx, nil)
|
||||
if err != nil {
|
||||
>>>>>>> Initial creation of workflows building block
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -84,6 +84,7 @@ jobs:
|
|||
- state.cockroachdb
|
||||
- workflows.temporal
|
||||
- state.rethinkdb
|
||||
- workflows.temporal
|
||||
EOF
|
||||
)
|
||||
echo "::set-output name=pr-components::$PR_COMPONENTS"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
COMPOSE_PROJECT_NAME=temporal
|
||||
CASSANDRA_VERSION=3.11.9
|
||||
ELASTICSEARCH_VERSION=7.16.2
|
||||
MYSQL_VERSION=8
|
||||
POSTGRESQL_VERSION=13
|
||||
TEMPORAL_VERSION=1.17.1
|
||||
TEMPORAL_WEB_VERSION=1.15.0
|
||||
TEMPORAL_UI_VERSION=2.2.3
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
version: "3.5"
|
||||
services:
|
||||
postgresql:
|
||||
container_name: temporal-postgresql
|
||||
environment:
|
||||
POSTGRES_PASSWORD: temporal
|
||||
POSTGRES_USER: temporal
|
||||
image: postgres:${POSTGRESQL_VERSION}
|
||||
networks:
|
||||
- temporal-network
|
||||
ports:
|
||||
- 5432:5432
|
||||
temporal:
|
||||
container_name: temporal
|
||||
depends_on:
|
||||
- postgresql
|
||||
environment:
|
||||
- DB=postgresql
|
||||
- DB_PORT=5432
|
||||
- POSTGRES_USER=temporal
|
||||
- POSTGRES_PWD=temporal
|
||||
- POSTGRES_SEEDS=postgresql
|
||||
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
|
||||
image: temporalio/auto-setup:${TEMPORAL_VERSION}
|
||||
networks:
|
||||
- temporal-network
|
||||
ports:
|
||||
- 7233:7233
|
||||
volumes:
|
||||
- ./dynamicconfig:/etc/temporal/config/dynamicconfig
|
||||
networks:
|
||||
temporal-network:
|
||||
driver: bridge
|
||||
name: temporal-network
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
Use `docker.yaml` file to override the default dynamic config value (they are specified
|
||||
when creating the service config).
|
||||
|
||||
Each key can have zero or more values and each value can have zero or more
|
||||
constraints. There are only three types of constraint:
|
||||
1. `namespace`: `string`
|
||||
2. `taskQueueName`: `string`
|
||||
3. `taskType`: `int` (`1`:`Workflow`, `2`:`Activity`)
|
||||
A value will be selected and returned if all its has exactly the same constraints
|
||||
as the ones specified in query filters (including the number of constraints).
|
||||
|
||||
Please use the following format:
|
||||
```
|
||||
testGetBoolPropertyKey:
|
||||
- value: false
|
||||
- value: true
|
||||
constraints:
|
||||
namespace: "global-samples-namespace"
|
||||
- value: false
|
||||
constraints:
|
||||
namespace: "samples-namespace"
|
||||
testGetDurationPropertyKey:
|
||||
- value: "1m"
|
||||
constraints:
|
||||
namespace: "samples-namespace"
|
||||
taskQueueName: "longIdleTimeTaskqueue"
|
||||
testGetFloat64PropertyKey:
|
||||
- value: 12.0
|
||||
constraints:
|
||||
namespace: "samples-namespace"
|
||||
testGetMapPropertyKey:
|
||||
- value:
|
||||
key1: 1
|
||||
key2: "value 2"
|
||||
key3:
|
||||
- false
|
||||
- key4: true
|
||||
key5: 2.0
|
||||
```
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
system.forceSearchAttributesCacheRefreshOnRead:
|
||||
- value: true # Dev setup only. Please don't turn this on in production.
|
||||
constraints: {}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
limit.maxIDLength:
|
||||
- value: 255
|
||||
constraints: {}
|
||||
system.forceSearchAttributesCacheRefreshOnRead:
|
||||
- value: true # Dev setup only. Please don't turn this on in production.
|
||||
constraints: {}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
Copyright 2021 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 temporal_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
// "github.com/dapr/components-contrib/workflows"
|
||||
)
|
||||
|
||||
func TestTemporal(t *testing.T) {
|
||||
log := logger.NewLogger("dapr.components")
|
||||
ports, err := dapr_testing.GetFreePorts(2)
|
||||
assert.NoError(t, err)
|
||||
|
||||
currentGrpcPort := ports[0]
|
||||
currentHTTPPort := ports[1]
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
Copyright 2021 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 temporal
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
workflows "github.com/dapr/components-contrib/workflows"
|
||||
"github.com/dapr/kit/logger"
|
||||
"gotest.tools/assert"
|
||||
)
|
||||
|
||||
func TestStartTemporalClient(t *testing.T) {
|
||||
m := workflows.Metadata{}
|
||||
m.Properties = map[string]string{
|
||||
"Identity": "TemporalTestClient",
|
||||
"HostPort": "localhost:7233",
|
||||
}
|
||||
temporal := TemporalWF{logger: logger.NewLogger("TemporalTestLogger")}
|
||||
err := temporal.Init(m)
|
||||
assert.Equal(t, nil, err)
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue