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/components-contrib/metadata"
|
||||
"github.com/dapr/components-contrib/tests/conformance/utils"
|
||||
"github.com/dapr/components-contrib/workflows"
|
||||
)
|
||||
|
@ -50,7 +51,7 @@ func ConformanceTests(t *testing.T, props map[string]string, workflowItem workfl
|
|||
// Test vars
|
||||
t.Run("init", func(t *testing.T) {
|
||||
err := workflowItem.Init(workflows.Metadata{
|
||||
Properties: props,
|
||||
Base: metadata.Base{Properties: props},
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
|
|
@ -13,7 +13,9 @@ limitations under the License.
|
|||
|
||||
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 {
|
||||
Properties map[string]string `json:"properties"`
|
||||
metadata.Base `json:",inline"`
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ package temporal
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
@ -23,6 +22,7 @@ import (
|
|||
"go.temporal.io/api/enums/v1"
|
||||
"go.temporal.io/sdk/client"
|
||||
|
||||
"github.com/dapr/components-contrib/metadata"
|
||||
"github.com/dapr/components-contrib/workflows"
|
||||
"github.com/dapr/kit/logger"
|
||||
)
|
||||
|
@ -128,20 +128,10 @@ func (c *TemporalWF) Close() {
|
|||
c.client.Close()
|
||||
}
|
||||
|
||||
func (c *TemporalWF) parseMetadata(metadata workflows.Metadata) (*temporalMetadata, error) {
|
||||
connInfo := metadata.Properties
|
||||
b, err := json.Marshal(connInfo)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var creds temporalMetadata
|
||||
err = json.Unmarshal(b, &creds)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &creds, nil
|
||||
func (c *TemporalWF) parseMetadata(meta workflows.Metadata) (*temporalMetadata, error) {
|
||||
var m temporalMetadata
|
||||
err := metadata.DecodeMetadata(meta.Properties, &m)
|
||||
return &m, err
|
||||
}
|
||||
|
||||
func lookupStatus(status enums.WorkflowExecutionStatus) string {
|
||||
|
|
Loading…
Reference in New Issue