Adding in optional parameter for a namespace into temporal
Signed-off-by: Ryan Lettieri <ryanLettieri@microsoft.com>
This commit is contained in:
parent
9e71493da7
commit
9d39e9ee87
|
@ -22,6 +22,7 @@ import (
|
||||||
|
|
||||||
"github.com/dapr/kit/logger"
|
"github.com/dapr/kit/logger"
|
||||||
|
|
||||||
|
"github.com/dapr/components-contrib/metadata"
|
||||||
"github.com/dapr/components-contrib/tests/conformance/utils"
|
"github.com/dapr/components-contrib/tests/conformance/utils"
|
||||||
"github.com/dapr/components-contrib/workflows"
|
"github.com/dapr/components-contrib/workflows"
|
||||||
)
|
)
|
||||||
|
@ -50,7 +51,7 @@ func ConformanceTests(t *testing.T, props map[string]string, workflowItem workfl
|
||||||
// Test vars
|
// Test vars
|
||||||
t.Run("init", func(t *testing.T) {
|
t.Run("init", func(t *testing.T) {
|
||||||
err := workflowItem.Init(workflows.Metadata{
|
err := workflowItem.Init(workflows.Metadata{
|
||||||
Properties: props,
|
Base: metadata.Base{Properties: props},
|
||||||
})
|
})
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
|
@ -13,7 +13,9 @@ limitations under the License.
|
||||||
|
|
||||||
package workflows
|
package workflows
|
||||||
|
|
||||||
// Metadata represents a set of binding specific properties.
|
import "github.com/dapr/components-contrib/metadata"
|
||||||
|
|
||||||
|
// Metadata represents a set of workflow specific properties.
|
||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
Properties map[string]string `json:"properties"`
|
metadata.Base `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ package temporal
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
@ -23,6 +22,7 @@ import (
|
||||||
"go.temporal.io/api/enums/v1"
|
"go.temporal.io/api/enums/v1"
|
||||||
"go.temporal.io/sdk/client"
|
"go.temporal.io/sdk/client"
|
||||||
|
|
||||||
|
"github.com/dapr/components-contrib/metadata"
|
||||||
"github.com/dapr/components-contrib/workflows"
|
"github.com/dapr/components-contrib/workflows"
|
||||||
"github.com/dapr/kit/logger"
|
"github.com/dapr/kit/logger"
|
||||||
)
|
)
|
||||||
|
@ -128,20 +128,10 @@ func (c *TemporalWF) Close() {
|
||||||
c.client.Close()
|
c.client.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *TemporalWF) parseMetadata(metadata workflows.Metadata) (*temporalMetadata, error) {
|
func (c *TemporalWF) parseMetadata(meta workflows.Metadata) (*temporalMetadata, error) {
|
||||||
connInfo := metadata.Properties
|
var m temporalMetadata
|
||||||
b, err := json.Marshal(connInfo)
|
err := metadata.DecodeMetadata(meta.Properties, &m)
|
||||||
if err != nil {
|
return &m, err
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var creds temporalMetadata
|
|
||||||
err = json.Unmarshal(b, &creds)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &creds, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func lookupStatus(status enums.WorkflowExecutionStatus) string {
|
func lookupStatus(status enums.WorkflowExecutionStatus) string {
|
||||||
|
|
Loading…
Reference in New Issue