Create a new directory for the new microservice. If you expect the solution to have a large number of microservice, you might want to create a nested structure. Lowercase directory names are recommended.
mkdir mydomain/myservice
Create mydomain/myservice/doc.go with the go:generate instruction that will run the code generator. It is recommended to echo the name of the directory for the name of the package.
//go:generate go run github.com/microbus-io/fabric/codegen
package myservice
service.yamlFrom within the directory, run go generate to create an empty service.yaml template.
cd mydomain/myservice
go generate
Fill in the characteristics of the microservice in service.yaml, and go generate again to generate the skeleton code for the new microservice and its client stubs.
Implement the functionality of the microservice in service.go and test it in service_test.go.
Run go generate a final time to update the version number of the microservice.
Include the new microservice in the application in main.go if not already done so by the code generator.
app.Add(
// Add solution microservices here
myservice.NewService(),
)