Skip to content

Commit

Permalink
Merge pull request #1048 from asynkron/fix-examples
Browse files Browse the repository at this point in the history
Fix examples
  • Loading branch information
rogeralsing authored Apr 6, 2024
2 parents 98b5bb6 + 22c10dc commit b92b3b7
Show file tree
Hide file tree
Showing 49 changed files with 1,530 additions and 60 deletions.
2 changes: 1 addition & 1 deletion cluster/cluster.pb.go

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

2 changes: 1 addition & 1 deletion cluster/cluster_test_tool/pubsub_cluster.pb.go

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

2 changes: 1 addition & 1 deletion cluster/gossip.pb.go

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

2 changes: 1 addition & 1 deletion cluster/grain.pb.go

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

2 changes: 1 addition & 1 deletion cluster/pubsub.pb.go

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

2 changes: 1 addition & 1 deletion cluster/pubsub_test.pb.go

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

4 changes: 2 additions & 2 deletions examples/cluster-basic/node1/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package main

import (
"cluster-basic/shared"
"fmt"

console "github.com/asynkron/goconsole"
"github.com/asynkron/protoactor-go/actor"
"github.com/asynkron/protoactor-go/cluster"
Expand All @@ -18,7 +18,7 @@ func main() {
console.ReadLine()
pid := c.Get("abc", "hello")
fmt.Printf("Got pid %v", pid)
res, _ := c.Request("abc", "hello", &actor.Touch{})
res, _ := c.Request("abc", "hello", &shared.HelloRequest{Name: "Roger"})
fmt.Printf("Got response %v", res)

fmt.Println()
Expand Down
3 changes: 2 additions & 1 deletion examples/cluster-basic/node2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ func startNode() *cluster.Cluster {
switch msg := ctx.Message().(type) {
case *actor.Started:
fmt.Printf("Started %v", msg)
case *shared.Hello:
case *shared.HelloRequest:
fmt.Printf("Hello %v\n", msg.Name)
ctx.Respond(&shared.HelloResponse{})
}
})
helloKind := cluster.NewKind("hello", props)
Expand Down
95 changes: 74 additions & 21 deletions examples/cluster-basic/shared/protos.pb.go

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

6 changes: 5 additions & 1 deletion examples/cluster-basic/shared/protos.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ syntax = "proto3";
package shared;
option go_package = "github.com/asynkron/protoactor-go/examples/cluster-basic/shared";

message Hello {
message HelloRequest {
string name = 1;
}

message HelloResponse {

}
2 changes: 1 addition & 1 deletion examples/cluster-broadcast/shared/protos.pb.go

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

2 changes: 1 addition & 1 deletion examples/cluster-broadcast/shared/protos_grain.pb.go

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

2 changes: 1 addition & 1 deletion examples/cluster-error-response/protos.pb.go

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

2 changes: 1 addition & 1 deletion examples/cluster-error-response/protos_grain.pb.go

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

2 changes: 1 addition & 1 deletion examples/cluster-eventstream-broadcast/protos.pb.go

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

48 changes: 48 additions & 0 deletions examples/cluster-gossip/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3.7'
services:

consul-agent-1: &consul-agent
image: hashicorp/consul:latest
networks:
- consul
command: "agent -retry-join consul-server-bootstrap -client 0.0.0.0"

consul-agent-2:
<<: *consul-agent

consul-agent-3:
<<: *consul-agent

consul-server-1: &consul-server
<<: *consul-agent
command: "agent -server -retry-join consul-server-bootstrap -client 0.0.0.0"

consul-server-2:
<<: *consul-server

consul-server-bootstrap:
<<: *consul-agent
ports:
- "8400:8400"
- "8500:8500"
- "8600:8600"
- "8600:8600/udp"
command: "agent -server -bootstrap-expect 3 -ui -client 0.0.0.0"

mongodb:
image: mongo:latest
ports:
- 127.0.0.1:27017:27017
volumes:
- mongodb_data:/data/db

redis:
image: redis:latest
ports:
- 127.0.0.1:6379:6379

networks:
consul:

volumes:
mongodb_data:
Loading

0 comments on commit b92b3b7

Please sign in to comment.