forked from stakwork/sphinx-tribes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request stakwork#1956 from MahtabBukhari/Implement_Workflo…
…w_Request_Handler Implement Workflow Request Handler Create Workflow Processing Utilities
- Loading branch information
Showing
3 changed files
with
120 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package utils | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"github.com/google/uuid" | ||
) | ||
|
||
type ProcessorConfig struct { | ||
RequiresProcessing bool | ||
HandlerFunc string | ||
Config json.RawMessage | ||
} | ||
|
||
func ProcessWorkflowRequest(requestID string, source string) (string, error) { | ||
|
||
if requestID == "" { | ||
requestID = uuid.New().String() | ||
} | ||
|
||
config := lookupProcessingConfig(source) | ||
|
||
if config == nil { | ||
return requestID, nil | ||
} | ||
|
||
return processWithHandler(requestID) | ||
} | ||
|
||
func lookupProcessingConfig(source string) error { | ||
return nil | ||
} | ||
|
||
func processWithHandler(requestID string) (string, error) { | ||
fmt.Println("Processing with default handler") | ||
return fmt.Sprintf("Processed with default handler, RequestID: %s", requestID), nil | ||
} |