Skip to content

Commit

Permalink
Fixed issue where Compose() gateway types didn't match up. (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
robsignorelli authored May 10, 2022
1 parent a4d230a commit ecd1df5
Show file tree
Hide file tree
Showing 14 changed files with 216 additions and 145 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -823,9 +823,9 @@ projectGateway := projects.NewProjectServiceGateway(projectService)

// Wrap them in a composed gateway that routes requests to all three.
gateway := rpc.Compose(
userGateway,
groupGateway,
projectGateway,
userGateway.Gateway,
groupGateway.Gateway,
projectGateway.Gateway,
)
http.listenAndService(":8080", gateway)
```
Expand Down
6 changes: 4 additions & 2 deletions example/basic/calc/gen/calculator_service.gen.client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions example/basic/calc/gen/calculator_service.gen.gateway.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions example/compose/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ func startGateways() {

// Combine the gateways for all of our services into a single gateway that routes requests to all of them.
gateway := rpc.Compose(
calcrpc.NewCalculatorServiceGateway(&calcService),
scoresrpc.NewScoreServiceGateway(&scoreService),
gamesrpc.NewGameServiceGateway(&gameService),
calcrpc.NewCalculatorServiceGateway(&calcService).Gateway,
scoresrpc.NewScoreServiceGateway(&scoreService).Gateway,
gamesrpc.NewGameServiceGateway(&gameService).Gateway,
)
http.ListenAndServe(":9004", gateway)
}
Expand Down
6 changes: 4 additions & 2 deletions example/multiservice/games/gen/game_service.gen.client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions example/multiservice/games/gen/game_service.gen.gateway.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions example/multiservice/makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#
# This runs the games service in a local process exposing it on port 9001.
#
run-game-service:
frodo gateway games/game_service.go && \
frodo client games/game_service.go && \
run-game-service: frodo
go run games/cmd/main.go

#
# This runs the score service in a local process exposing it on port 9002.
#
run-score-service:
frodo gateway scores/score_service.go && \
frodo client scores/score_service.go && \
run-score-service: frodo
go run scores/cmd/main.go

#
Expand All @@ -21,3 +17,12 @@ run-score-service:
#
run:
go run main.go

#
# Generates the frodo artifacts for all of the services.
#
frodo:
frodo gateway games/game_service.go && \
frodo client games/game_service.go && \
frodo gateway scores/score_service.go && \
frodo client scores/score_service.go
6 changes: 4 additions & 2 deletions example/multiservice/scores/gen/score_service.gen.client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 24 additions & 4 deletions example/multiservice/scores/gen/score_service.gen.gateway.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ecd1df5

Please sign in to comment.