Skip to content

Commit

Permalink
IWF-105: Rename handleevent > event package
Browse files Browse the repository at this point in the history
  • Loading branch information
lwolczynski committed Nov 18, 2024
1 parent 72d1587 commit 3f87f10
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package handleevent
package event

import "github.com/indeedeng/iwf/gen/iwfidl"

Expand Down
14 changes: 7 additions & 7 deletions service/interpreter/activityImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/indeedeng/iwf/gen/iwfidl"
"github.com/indeedeng/iwf/service"
"github.com/indeedeng/iwf/service/common/compatibility"
"github.com/indeedeng/iwf/service/common/handleevent"
"github.com/indeedeng/iwf/service/common/event"
"github.com/indeedeng/iwf/service/common/ptr"
"github.com/indeedeng/iwf/service/common/rpc"
"github.com/indeedeng/iwf/service/common/urlautofix"
Expand Down Expand Up @@ -54,7 +54,7 @@ func StateApiWaitUntil(
resp, httpResp, err := req.WorkflowStateStartRequest(input.Request).Execute()
printDebugMsg(logger, err, iwfWorkerBaseUrl)
if checkHttpError(err, httpResp) {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -66,7 +66,7 @@ func StateApiWaitUntil(
}

if err := checkCommandRequestFromWaitUntilResponse(resp); err != nil {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -82,7 +82,7 @@ func StateApiWaitUntil(
resp.LocalActivityInput = composeInputForDebug(input.Request.Context.GetStateExecutionId())
}

handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_ATTEMPT_SUCC_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand Down Expand Up @@ -133,7 +133,7 @@ func StateApiExecute(
resp, httpResp, err := req.WorkflowStateDecideRequest(input.Request).Execute()
printDebugMsg(logger, err, iwfWorkerBaseUrl)
if checkHttpError(err, httpResp) {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -147,7 +147,7 @@ func StateApiExecute(
}

if err = checkStateDecisionFromResponse(resp); err != nil {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_ATTEMPT_FAIL_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand All @@ -165,7 +165,7 @@ func StateApiExecute(
resp.LocalActivityInput = composeInputForDebug(input.Request.Context.GetStateExecutionId())
}

handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_ATTEMPT_SUCC_EVENT,
WorkflowType: input.Request.WorkflowType,
WorkflowId: activityInfo.WorkflowExecution.ID,
Expand Down
20 changes: 10 additions & 10 deletions service/interpreter/workflowImpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
uclient "github.com/indeedeng/iwf/service/client"
"github.com/indeedeng/iwf/service/common/handleevent"
"github.com/indeedeng/iwf/service/common/event"
"github.com/indeedeng/iwf/service/common/ptr"
"github.com/indeedeng/iwf/service/common/utils"
"github.com/indeedeng/iwf/service/interpreter/env"
Expand All @@ -24,7 +24,7 @@ func InterpreterImpl(
if !provider.IsReplaying(ctx) {
// send metrics for the workflow result
if retErr == nil {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.WORKFLOW_COMPLETE_EVENT,
WorkflowType: input.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -33,7 +33,7 @@ func InterpreterImpl(
EndTimestampInMs: ptr.Any(provider.Now(ctx).UnixMilli()),
})
} else if provider.IsApplicationError(retErr) {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.WORKFLOW_FAIL_EVENT,
WorkflowType: input.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down Expand Up @@ -147,7 +147,7 @@ func InterpreterImpl(

if !input.IsResumeFromContinueAsNew {
if !provider.IsReplaying(ctx) {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.WORKFLOW_START_EVENT,
WorkflowType: input.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down Expand Up @@ -561,7 +561,7 @@ func processStateExecution(
doLoadingPolicy := compatibility.GetWaitUntilApiDataObjectsLoadingPolicy(state.StateOptions)

if !provider.IsReplaying(ctx) {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_START_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -583,14 +583,14 @@ func processStateExecution(
})
if !provider.IsReplaying(ctx) {
if errStartApi == nil {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_FAIL_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
WorkflowRunId: provider.GetWorkflowInfo(ctx).WorkflowExecution.RunID,
})
} else {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_WAIT_UNTIL_EE_COMPLETE_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down Expand Up @@ -824,7 +824,7 @@ func invokeStateExecute(
var decideResponse *iwfidl.WorkflowStateDecideResponse

if !provider.IsReplaying(ctx) {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_EE_START_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -850,7 +850,7 @@ func invokeStateExecute(
})
if !provider.IsReplaying(ctx) {
if err == nil {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_EE_COMPLETE_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand All @@ -861,7 +861,7 @@ func invokeStateExecute(
EndTimestampInMs: ptr.Any(provider.Now(ctx).UnixMilli()),
})
} else {
handleevent.Handle(iwfidl.IwfEvent{
event.Handle(iwfidl.IwfEvent{
EventType: iwfidl.STATE_EXECUTE_EE_FAIL_EVENT,
WorkflowType: basicInfo.IwfWorkflowType,
WorkflowId: provider.GetWorkflowInfo(ctx).WorkflowExecution.ID,
Expand Down

0 comments on commit 3f87f10

Please sign in to comment.