本文整理汇总了Golang中github.com/awslabs/aws-sdk-go/service/swf.New函数的典型用法代码示例。如果您正苦于以下问题:Golang New函数的具体用法?Golang New怎么用?Golang New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了New函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ExampleSWF_PollForDecisionTask
func ExampleSWF_PollForDecisionTask() {
svc := swf.New(nil)
params := &swf.PollForDecisionTaskInput{
Domain: aws.String("DomainName"), // Required
TaskList: &swf.TaskList{ // Required
Name: aws.String("Name"), // Required
},
Identity: aws.String("Identity"),
MaximumPageSize: aws.Long(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Boolean(true),
}
resp, err := svc.PollForDecisionTask(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:33,代码来源:examples_test.go
示例2: ExampleSWF_DescribeActivityType
func ExampleSWF_DescribeActivityType() {
svc := swf.New(nil)
params := &swf.DescribeActivityTypeInput{
ActivityType: &swf.ActivityType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
Domain: aws.String("DomainName"), // Required
}
resp, err := svc.DescribeActivityType(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:30,代码来源:examples_test.go
示例3: ExampleSWF_RequestCancelWorkflowExecution
func ExampleSWF_RequestCancelWorkflowExecution() {
svc := swf.New(nil)
params := &swf.RequestCancelWorkflowExecutionInput{
Domain: aws.String("DomainName"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
RunID: aws.String("RunIdOptional"),
}
resp, err := svc.RequestCancelWorkflowExecution(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:28,代码来源:examples_test.go
示例4: ExampleSWF_RespondActivityTaskFailed
func ExampleSWF_RespondActivityTaskFailed() {
svc := swf.New(nil)
params := &swf.RespondActivityTaskFailedInput{
TaskToken: aws.String("TaskToken"), // Required
Details: aws.String("Data"),
Reason: aws.String("FailureReason"),
}
resp, err := svc.RespondActivityTaskFailed(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:28,代码来源:examples_test.go
示例5: ExampleSWF_GetWorkflowExecutionHistory
func ExampleSWF_GetWorkflowExecutionHistory() {
svc := swf.New(nil)
params := &swf.GetWorkflowExecutionHistoryInput{
Domain: aws.String("DomainName"), // Required
Execution: &swf.WorkflowExecution{ // Required
RunID: aws.String("RunId"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
},
MaximumPageSize: aws.Long(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Boolean(true),
}
resp, err := svc.GetWorkflowExecutionHistory(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:33,代码来源:examples_test.go
示例6: ExampleSWF_ListClosedWorkflowExecutions
func ExampleSWF_ListClosedWorkflowExecutions() {
svc := swf.New(nil)
params := &swf.ListClosedWorkflowExecutionsInput{
Domain: aws.String("DomainName"), // Required
CloseStatusFilter: &swf.CloseStatusFilter{
Status: aws.String("CloseStatus"), // Required
},
CloseTimeFilter: &swf.ExecutionTimeFilter{
OldestDate: aws.Time(time.Now()), // Required
LatestDate: aws.Time(time.Now()),
},
ExecutionFilter: &swf.WorkflowExecutionFilter{
WorkflowID: aws.String("WorkflowId"), // Required
},
MaximumPageSize: aws.Long(1),
NextPageToken: aws.String("PageToken"),
ReverseOrder: aws.Boolean(true),
StartTimeFilter: &swf.ExecutionTimeFilter{
OldestDate: aws.Time(time.Now()), // Required
LatestDate: aws.Time(time.Now()),
},
TagFilter: &swf.TagFilter{
Tag: aws.String("Tag"), // Required
},
TypeFilter: &swf.WorkflowTypeFilter{
Name: aws.String("Name"), // Required
Version: aws.String("VersionOptional"),
},
}
resp, err := svc.ListClosedWorkflowExecutions(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:50,代码来源:examples_test.go
示例7: TestMigrateWorkflowTypes
func TestMigrateWorkflowTypes(t *testing.T) {
if os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
log.Printf("WARNING: NO AWS CREDS SPECIFIED, SKIPPING MIGRATIONS TEST")
return
}
createDomain()
config := &aws.Config{
Credentials: credentials.NewEnvCredentials(),
Region: "us-east-1",
}
client := swf.New(config)
workflow := fmt.Sprintf("test-workflow-%d", time.Now().UnixNano())
version := fmt.Sprintf("test-workflow-version-%d", time.Now().UnixNano())
req := swf.RegisterWorkflowTypeInput{
Name: &workflow,
Description: aws.String("test workflow migration"),
Version: &version,
Domain: aws.String(testDomain),
}
w := WorkflowTypeMigrator{
RegisteredWorkflowTypes: []swf.RegisterWorkflowTypeInput{req},
Client: client,
}
w.Migrate()
w.Migrate()
dep := swf.DeprecateWorkflowTypeInput{
WorkflowType: &swf.WorkflowType{
Name: aws.String(workflow),
Version: aws.String(version),
},
Domain: aws.String(testDomain),
}
wd := WorkflowTypeMigrator{
DeprecatedWorkflowTypes: []swf.DeprecateWorkflowTypeInput{dep},
Client: client,
}
wd.Migrate()
wd.Migrate()
}
开发者ID:freeformz,项目名称:swfsm,代码行数:47,代码来源:migrator_test.go
示例8: TestMigrateActivityTypes
func TestMigrateActivityTypes(t *testing.T) {
if os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
log.Printf("WARNING: NO AWS CREDS SPECIFIED, SKIPPING MIGRATIONS TEST")
return
}
createDomain()
config := &aws.Config{
Credentials: credentials.NewEnvCredentials(),
Region: "us-east-1",
}
client := swf.New(config)
activity := fmt.Sprintf("test-activity-%d", time.Now().UnixNano())
version := fmt.Sprintf("test-activity-version-%d", time.Now().UnixNano())
req := swf.RegisterActivityTypeInput{
Name: &activity,
Description: aws.String("test activity migration"),
Version: &version,
Domain: aws.String(testDomain),
}
a := ActivityTypeMigrator{
RegisteredActivityTypes: []swf.RegisterActivityTypeInput{req},
Client: client,
}
a.Migrate()
a.Migrate()
dep := swf.DeprecateActivityTypeInput{
ActivityType: &swf.ActivityType{
Name: &activity,
Version: &version,
},
Domain: aws.String(testDomain),
}
ad := ActivityTypeMigrator{
DeprecatedActivityTypes: []swf.DeprecateActivityTypeInput{dep},
Client: client,
}
ad.Migrate()
ad.Migrate()
}
开发者ID:freeformz,项目名称:swfsm,代码行数:47,代码来源:migrator_test.go
示例9: createDomain
func createDomain() {
config := &aws.Config{
Credentials: credentials.NewEnvCredentials(),
Region: "us-east-1",
}
client := swf.New(config)
req := swf.RegisterDomainInput{
Name: aws.String(testDomain),
Description: aws.String("test domain"),
WorkflowExecutionRetentionPeriodInDays: aws.String("30"),
}
w := DomainMigrator{
RegisteredDomains: []swf.RegisterDomainInput{req},
Client: client,
}
w.Migrate()
}
开发者ID:freeformz,项目名称:swfsm,代码行数:18,代码来源:migrator_test.go
示例10: ExampleSWF_StartWorkflowExecution
func ExampleSWF_StartWorkflowExecution() {
svc := swf.New(nil)
params := &swf.StartWorkflowExecutionInput{
Domain: aws.String("DomainName"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
WorkflowType: &swf.WorkflowType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
ChildPolicy: aws.String("ChildPolicy"),
ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
TagList: []*string{
aws.String("Tag"), // Required
// More values...
},
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
}
resp, err := svc.StartWorkflowExecution(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:43,代码来源:examples_test.go
示例11: TestMigrateDomains
func TestMigrateDomains(t *testing.T) {
if os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
log.Printf("WARNING: NO AWS CREDS SPECIFIED, SKIPPING MIGRATIONS TEST")
return
}
config := &aws.Config{
Credentials: credentials.NewEnvCredentials(),
Region: "us-east-1",
}
client := swf.New(config)
domain := fmt.Sprintf("test-domain-%d", time.Now().UnixNano()) //dont use the testDomain since we deprecate this one
req := swf.RegisterDomainInput{
Name: aws.String(domain),
Description: aws.String("test domain"),
WorkflowExecutionRetentionPeriodInDays: aws.String("30"),
}
d := DomainMigrator{
RegisteredDomains: []swf.RegisterDomainInput{req},
Client: client,
}
d.Migrate()
d.Migrate()
dep := swf.DeprecateDomainInput{
Name: aws.String(domain),
}
dd := DomainMigrator{
DeprecatedDomains: []swf.DeprecateDomainInput{dep},
Client: client,
}
dd.Migrate()
dd.Migrate()
}
开发者ID:freeformz,项目名称:swfsm,代码行数:41,代码来源:migrator_test.go
示例12: ExampleSWF_RegisterActivityType
func ExampleSWF_RegisterActivityType() {
svc := swf.New(nil)
params := &swf.RegisterActivityTypeInput{
Domain: aws.String("DomainName"), // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
DefaultTaskHeartbeatTimeout: aws.String("DurationInSecondsOptional"),
DefaultTaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
DefaultTaskPriority: aws.String("TaskPriority"),
DefaultTaskScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
DefaultTaskScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
DefaultTaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Description: aws.String("Description"),
}
resp, err := svc.RegisterActivityType(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS Error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, The SDK should alwsy return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
开发者ID:navneet-flipkart,项目名称:confd,代码行数:37,代码来源:examples_test.go
示例13: init
func init() {
Before("@swf", func() {
World["client"] = swf.New(nil)
})
}
开发者ID:ninefive,项目名称:confd,代码行数:5,代码来源:client.go
示例14: TestClient
func TestClient(t *testing.T) {
if os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
log.Printf("WARNING: NO AWS CREDS SPECIFIED, SKIPPING MIGRATIONS TEST")
return
}
config := &aws.Config{
Credentials: credentials.NewEnvCredentials(),
Region: "us-east-1",
}
client := swf.New(config)
req := swf.RegisterDomainInput{
Name: aws.String("client-test"),
Description: aws.String("test domain"),
WorkflowExecutionRetentionPeriodInDays: aws.String("30"),
}
d := migrator.DomainMigrator{
RegisteredDomains: []swf.RegisterDomainInput{req},
Client: client,
}
d.Migrate()
wreq := swf.RegisterWorkflowTypeInput{
Name: aws.String("client-test"),
Description: aws.String("test workflow migration"),
Version: aws.String("1"),
Domain: aws.String("client-test"),
}
w := migrator.WorkflowTypeMigrator{
RegisteredWorkflowTypes: []swf.RegisterWorkflowTypeInput{wreq},
Client: client,
}
w.Migrate()
fsm := &FSM{
Domain: "client-test",
Name: "client-test",
DataType: TestData{},
Serializer: JSONStateSerializer{},
systemSerializer: JSONStateSerializer{},
allowPanics: false,
}
fsm.AddInitialState(&FSMState{Name: "initial",
Decider: func(ctx *FSMContext, h *swf.HistoryEvent, data interface{}) Outcome {
if *h.EventType == enums.EventTypeWorkflowExecutionSignaled {
d := data.(*TestData)
d.States = append(d.States, *h.WorkflowExecutionSignaledEventAttributes.SignalName)
}
return ctx.Stay(data, ctx.EmptyDecisions())
},
})
fsmClient := NewFSMClient(fsm, client)
workflow := uuid.New()
testData := uuid.New()
startTemplate := swf.StartWorkflowExecutionInput{
WorkflowType: &swf.WorkflowType{Name: aws.String("client-test"), Version: aws.String("1")},
ExecutionStartToCloseTimeout: aws.String("120"),
TaskStartToCloseTimeout: aws.String("120"),
ChildPolicy: aws.String("ABANDON"),
TaskList: &swf.TaskList{Name: aws.String("task-list")},
}
_, err := fsmClient.Start(startTemplate, workflow, &TestData{States: []string{testData}})
if err != nil {
t.Fatal(err)
}
state, data, err := fsmClient.GetState(workflow)
if err != nil {
t.Fatal(err)
}
if data.(*TestData).States[0] != testData {
t.Fatal(data)
}
if state != "initial" {
t.Fatal("not in initial")
}
found := false
err = fsmClient.WalkOpenWorkflowInfos(&swf.ListOpenWorkflowExecutionsInput{}, func(infos *swf.WorkflowExecutionInfos) error {
for _, info := range infos.ExecutionInfos {
if *info.Execution.WorkflowID == workflow {
found = true
return StopWalking()
}
}
return nil
})
if err != nil {
//.........这里部分代码省略.........
开发者ID:freeformz,项目名称:swfsm,代码行数:101,代码来源:client_test.go
示例15: TestInterface
func TestInterface(t *testing.T) {
assert.Implements(t, (*swfiface.SWFAPI)(nil), swf.New(nil))
}
开发者ID:freeformz,项目名称:swfsm,代码行数:3,代码来源:interface_test.go
示例16: ExampleSWF_RespondDecisionTaskCompleted
func ExampleSWF_RespondDecisionTaskCompleted() {
svc := swf.New(nil)
params := &swf.RespondDecisionTaskCompletedInput{
TaskToken: aws.String("TaskToken"), // Required
Decisions: []*swf.Decision{
&swf.Decision{ // Required
DecisionType: aws.String("DecisionType"), // Required
CancelTimerDecisionAttributes: &swf.CancelTimerDecisionAttributes{
TimerID: aws.String("TimerId"), // Required
},
CancelWorkflowExecutionDecisionAttributes: &swf.CancelWorkflowExecutionDecisionAttributes{
Details: aws.String("Data"),
},
CompleteWorkflowExecutionDecisionAttributes: &swf.CompleteWorkflowExecutionDecisionAttributes{
Result: aws.String("Data"),
},
ContinueAsNewWorkflowExecutionDecisionAttributes: &swf.ContinueAsNewWorkflowExecutionDecisionAttributes{
ChildPolicy: aws.String("ChildPolicy"),
ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
TagList: []*string{
aws.String("Tag"), // Required
// More values...
},
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
WorkflowTypeVersion: aws.String("Version"),
},
FailWorkflowExecutionDecisionAttributes: &swf.FailWorkflowExecutionDecisionAttributes{
Details: aws.String("Data"),
Reason: aws.String("FailureReason"),
},
RecordMarkerDecisionAttributes: &swf.RecordMarkerDecisionAttributes{
MarkerName: aws.String("MarkerName"), // Required
Details: aws.String("Data"),
},
RequestCancelActivityTaskDecisionAttributes: &swf.RequestCancelActivityTaskDecisionAttributes{
ActivityID: aws.String("ActivityId"), // Required
},
RequestCancelExternalWorkflowExecutionDecisionAttributes: &swf.RequestCancelExternalWorkflowExecutionDecisionAttributes{
WorkflowID: aws.String("WorkflowId"), // Required
Control: aws.String("Data"),
RunID: aws.String("RunIdOptional"),
},
ScheduleActivityTaskDecisionAttributes: &swf.ScheduleActivityTaskDecisionAttributes{
ActivityID: aws.String("ActivityId"), // Required
ActivityType: &swf.ActivityType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
Control: aws.String("Data"),
HeartbeatTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
ScheduleToCloseTimeout: aws.String("DurationInSecondsOptional"),
ScheduleToStartTimeout: aws.String("DurationInSecondsOptional"),
StartToCloseTimeout: aws.String("DurationInSecondsOptional"),
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
},
SignalExternalWorkflowExecutionDecisionAttributes: &swf.SignalExternalWorkflowExecutionDecisionAttributes{
SignalName: aws.String("SignalName"), // Required
WorkflowID: aws.String("WorkflowId"), // Required
Control: aws.String("Data"),
Input: aws.String("Data"),
RunID: aws.String("RunIdOptional"),
},
StartChildWorkflowExecutionDecisionAttributes: &swf.StartChildWorkflowExecutionDecisionAttributes{
WorkflowID: aws.String("WorkflowId"), // Required
WorkflowType: &swf.WorkflowType{ // Required
Name: aws.String("Name"), // Required
Version: aws.String("Version"), // Required
},
ChildPolicy: aws.String("ChildPolicy"),
Control: aws.String("Data"),
ExecutionStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
Input: aws.String("Data"),
TagList: []*string{
aws.String("Tag"), // Required
// More values...
},
TaskList: &swf.TaskList{
Name: aws.String("Name"), // Required
},
TaskPriority: aws.String("TaskPriority"),
TaskStartToCloseTimeout: aws.String("DurationInSecondsOptional"),
},
StartTimerDecisionAttributes: &swf.StartTimerDecisionAttributes{
StartToFireTimeout: aws.String("DurationInSeconds"), // Required
TimerID: aws.String("TimerId"), // Required
Control: aws.String("Data"),
},
},
// More values...
},
//.........这里部分代码省略.........
开发者ID:navneet-flipkart,项目名称:confd,代码行数:101,代码来源:examples_test.go
示例17: TestTypedActivityWorker
func TestTypedActivityWorker(t *testing.T) {
if os.Getenv("AWS_ACCESS_KEY_ID") == "" || os.Getenv("AWS_SECRET_ACCESS_KEY") == "" {
log.Printf("WARNING: NO AWS CREDS SPECIFIED, SKIPPING MIGRATIONS TEST")
return
}
config := &aws.Config{
Credentials: credentials.NewEnvCredentials(),
Region: "us-east-1",
}
client := swf.New(config)
domain := "worker-test-domain"
req := swf.RegisterDomainInput{
Name: aws.String(domain),
Description: aws.String("test domain"),
WorkflowExecutionRetentionPeriodInDays: aws.String("30"),
}
d := migrator.DomainMigrator{
RegisteredDomains: []swf.RegisterDomainInput{req},
Client: client,
}
d.Migrate()
workflow := "worker-test-workflow"
version := "worker-test-workflow-version"
wreq := swf.RegisterWorkflowTypeInput{
Name: &workflow,
Description: aws.String("test workflow migration"),
Version: &version,
Domain: aws.String(domain),
DefaultTaskList: &swf.TaskList{Name: S("worker-fsm")},
}
w := migrator.WorkflowTypeMigrator{
RegisteredWorkflowTypes: []swf.RegisterWorkflowTypeInput{wreq},
Client: client,
}
w.Migrate()
one := swf.RegisterActivityTypeInput{
Name: aws.String("one"),
Description: aws.String("worker test activity 1"),
Version: aws.String("one"),
Domain: aws.String(domain),
}
two := swf.RegisterActivityTypeInput{
Name: aws.String("two"),
Description: aws.String("worker test activity 2"),
Version: aws.String("two"),
Domain: aws.String(domain),
}
a := migrator.ActivityTypeMigrator{
RegisteredActivityTypes: []swf.RegisterActivityTypeInput{one, two},
Client: client,
}
a.Migrate()
taskList := "aTaskListSharedBetweenTaskOneAndTwo"
worker := &ActivityWorker{
Domain: domain,
Serializer: fsm.JSONStateSerializer{},
TaskList: taskList,
SWF: client,
Identity: "test-activity-worker",
}
//This is where the actual worker config code is
var activities Activities
activities = MockActivities{}
worker.AddHandler(NewActivityHandler("one", activities.Task1))
worker.AddHandler(NewActivityHandler("two", activities.Task2))
go worker.Start()
//yep thats all the worker config code
done := make(chan struct{})
go NewWorkerFSM(client, done).Start()
_, err := client.StartWorkflowExecution(&swf.StartWorkflowExecutionInput{
Domain: S(domain),
WorkflowID: S("worker-test"),
WorkflowType: &swf.WorkflowType{Name: S(workflow), Version: S(version)},
Input: S("{}"),
ExecutionStartToCloseTimeout: S("90"),
TaskStartToCloseTimeout: S("10"),
//.........这里部分代码省略.........
开发者ID:freeformz,项目名称:swfsm,代码行数:101,代码来源:worker_test.go
注:本文中的github.com/awslabs/aws-sdk-go/service/swf.New函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论