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.
mkdir mydomain/myservice
Create mydomain/myservice/doc.go
with the go:generate
instruction that will run the code generator.
//go:generate go run github.com/microbus-io/fabric/codegen
package myservice
service.yaml
From 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
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 integration_test.go
.
Run go generate
a final time to update the version number of the microservice.
Add the new microservice to the application in main.go
:
app.Add(
// Add solution microservices here
myservice.NewService(),
)
Repeat this step for each new microservice.