diff --git a/404.html b/404.html index d7e9c97..f1ffa83 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@
A Builder is a unit of work in the workflow. Builders must implement the IBuilder
interface.
type IBuilder interface {
GetBuilderInfo() BuilderInfo
Process(BuilderContext) IData
}
Following the same example, for the first unit of work in a cab ride workflow:
-var database Database
var cabbieHttpClient CabbieHttpClient
type UserInitiation struct {
}
func (uI UserInitiation) GetBuilderInfo() BuilderInfo {
return BuilderInfo{
Consumes: []IData{
UserInitiationRequest{},
},
Produces: UserInitiationResponse{},
Optionals: nil,
Accesses: nil,
}
}
func (uI UserInitiation) Process(context BuilderContext) IData {
userInitReq := context.get(UserInitiationRequest{})
// save the request in a database (different from Polaris storing workflows in `IDataStore`)
database.save(userInitReq)
// call another service to place a request, and wait for the response
cabbieResponse := cabbieHttpClient.request(RideRequest{
userId: userInitReq.userId,
source: userInitReq.source,
dest: userInitReq.dest
})
// once done, return the `Produces` of the data
return UserInitiationResponse{
success: true,
etaForCabbie: cabbieResponse.eta
}
}
var database Database
var cabbieHttpClient CabbieHttpClient
type UserInitiation struct {
}
func (uI UserInitiation) GetBuilderInfo() BuilderInfo {
return BuilderInfo{
Consumes: []IData{
UserInitiationRequest{},
},
Produces: UserInitiationResponse{},
Optionals: nil,
Accesses: nil,
}
}
func (uI UserInitiation) Process(context BuilderContext) IData {
userInitReq := context.Get(UserInitiationRequest{})
// save the request in a database (different from Polaris storing workflows in `IDataStore`)
database.save(userInitReq)
// call another service to place a request, and wait for the response
cabbieResponse := cabbieHttpClient.request(RideRequest{
userId: userInitReq.userId,
source: userInitReq.source,
dest: userInitReq.dest
})
// once done, return the `Produces` of the data
return UserInitiationResponse{
success: true,
etaForCabbie: cabbieResponse.eta
}
}