Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
iwaltgen committed Nov 29, 2023
2 parents ce09038 + f0865af commit 7f6c6eb
Show file tree
Hide file tree
Showing 241 changed files with 15,433 additions and 2,478 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go_version: ['1.18', '1.19']
go_version: ['1.21']
# services:
# redis:
# image: redis:5.0-alpine
# ports:
# - 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand Down Expand Up @@ -231,6 +231,7 @@ FakesAssemblies/

# go.sum of examples
_examples/**/go.sum
_examples/**/go.work.sum
.vscode/

/test_report.html
Expand Down
35 changes: 35 additions & 0 deletions _examples/actor-autorespond/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module autorespond

go 1.21

replace github.com/asynkron/protoactor-go => ../..

require github.com/asynkron/protoactor-go v0.0.0-00010101000000-000000000000

require (
github.com/Workiva/go-datastructures v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/lithammer/shortuuid/v4 v4.0.0 // indirect
github.com/lmittmann/tint v1.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/orcaman/concurrent-map v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.44.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
31 changes: 31 additions & 0 deletions _examples/actor-autorespond/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## AI Generated Content. Please report issues

# Go Example with Proto.Actor Auto Response

## Introduction
This Go example demonstrates the use of the Auto Response feature in the Proto.Actor framework. It illustrates how an actor can automatically generate a response to a message.

## Description
In this example, we define `myAutoResponder` and `myAutoResponse` types to use the Auto Response feature of Proto.Actor. This feature allows an actor to automatically create a response message upon receiving a specific type of message. This is particularly useful for acknowledging message receipt in systems like the ClusterPubSub feature.

## Setup
To run this example, ensure you have the following prerequisites:
- Go programming environment
- Proto.Actor for Go installed in your environment

You can install Proto.Actor using the following command:
```bash
go get -u github.com/asynkron/protoactor-go
```

## Running the Example

```bash
go run main.go
```

## Additional Notes
- The `myAutoResponder` struct implements the `GetAutoResponse` method which is essential for the Auto Response mechanism.
- The `main` function initializes an actor system, creates an actor, and sends a message to it. The response is then printed to the console.

This example provides a basic understanding of how to implement and use the Auto Response feature in the Proto.Actor framework in Go.
38 changes: 38 additions & 0 deletions _examples/actor-backpressure/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module backpressure

go 1.21

replace github.com/asynkron/protoactor-go => ../..

require (
github.com/asynkron/goconsole v0.0.0-20160504192649-bfa12eebf716
github.com/asynkron/protoactor-go v0.0.0-00010101000000-000000000000
)

require (
github.com/Workiva/go-datastructures v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/lithammer/shortuuid/v4 v4.0.0 // indirect
github.com/lmittmann/tint v1.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/orcaman/concurrent-map v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.44.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
39 changes: 39 additions & 0 deletions _examples/actor-deadletter/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module helloworld

go 1.21

replace github.com/asynkron/protoactor-go => ../..

require (
github.com/asynkron/goconsole v0.0.0-20160504192649-bfa12eebf716
github.com/asynkron/protoactor-go v0.0.0-00010101000000-000000000000
golang.org/x/time v0.3.0
)

require (
github.com/Workiva/go-datastructures v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/lithammer/shortuuid/v4 v4.0.0 // indirect
github.com/lmittmann/tint v1.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/orcaman/concurrent-map v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.44.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
33 changes: 33 additions & 0 deletions _examples/actor-deadletter/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## AI Generated Content. Please report issues

# Go Example: Handling Invalid PIDs with Deadletter in Proto.Actor

## Introduction
This Go example demonstrates handling invalid PIDs (Process Identifiers) using the deadletter mechanism in the Proto.Actor framework. It showcases how messages sent to invalid PIDs are managed by the deadletter handler.

## Description
The example sets up a scenario where messages are sent to an invalid PID. This triggers the deadletter mechanism, which is a way to handle messages that cannot be delivered to their intended recipients. The program includes options to adjust the rate of message sending, the throttle of deadletter logs, and the duration of the message-sending loop.

## Setup
To run this example, ensure the following are installed:
- Go programming environment
- Proto.Actor for Go

Install Proto.Actor with the following command:
```bash
go get -u github.com/asynkron/protoactor-go
```

## Running the Example

```bash
go run main.go
```
You can also pass optional flags like `--rate`, `--throttle`, and `--duration` to adjust the behavior of the example.

## Additional Notes
- The `main` function initializes an actor system with a custom configuration for deadletter handling.
- The program sends messages to a deliberately invalid PID to demonstrate how the deadletter mechanism works in Proto.Actor.
- The example is useful for understanding the deadletter process in actor-based systems, especially for error handling and debugging.

This example provides insight into managing undeliverable messages in the Proto.Actor framework using Go.
38 changes: 38 additions & 0 deletions _examples/actor-helloworld/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module helloworld

go 1.21

replace github.com/asynkron/protoactor-go => ../..

require (
github.com/asynkron/goconsole v0.0.0-20160504192649-bfa12eebf716
github.com/asynkron/protoactor-go v0.0.0-00010101000000-000000000000
)

require (
github.com/Workiva/go-datastructures v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/lithammer/shortuuid/v4 v4.0.0 // indirect
github.com/lmittmann/tint v1.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/orcaman/concurrent-map v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.44.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
28 changes: 28 additions & 0 deletions _examples/actor-helloworld/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
console "github.com/asynkron/goconsole"
"github.com/asynkron/protoactor-go/actor"
"log/slog"
)

type (
hello struct{ Who string }
helloActor struct{}
)

func (state *helloActor) Receive(context actor.Context) {
switch msg := context.Message().(type) {
case *hello:
context.Logger().Info("Hello ", slog.String("who", msg.Who))
}
}

func main() {
system := actor.NewActorSystem()
props := actor.PropsFromProducer(func() actor.Actor { return &helloActor{} })

pid := system.Root.Spawn(props)
system.Root.Send(pid, &hello{Who: "Roger"})
_, _ = console.ReadLine()
}
32 changes: 32 additions & 0 deletions _examples/actor-helloworld/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## AI Generated Content. Please report issues

# Go Example: Hello World with Proto.Actor

## Introduction
This simple Go example demonstrates a basic "Hello World" scenario using the Proto.Actor framework. It's a straightforward introduction to actor-based programming in Go.

## Description
The program defines a `hello` message struct and a `helloActor` actor type. The actor receives a `hello` message and logs a greeting to the console. This example is designed to be an entry point for understanding how actors receive and process messages in Proto.Actor.

## Setup
Ensure the following are installed to run this example:
- Go programming environment
- Proto.Actor for Go

To install Proto.Actor, use the command:
```bash
go get -u github.com/asynkron/protoactor-go
```

## Running the Example

```bash
go run main.go
```

## Additional Notes
- The `helloActor` struct implements the `Receive` method, which is triggered upon message arrival.
- The `main` function creates an actor system, spawns a `helloActor`, and sends it a `hello` message.
- This example is a great starting point for those new to the Proto.Actor framework and actor-based systems in Go.

This example provides a basic yet illustrative demonstration of using actors in Go with the Proto.Actor framework.
35 changes: 35 additions & 0 deletions _examples/actor-inprocess-benchmark/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module inprocessbenchmark

go 1.21

replace github.com/asynkron/protoactor-go => ../..

require github.com/asynkron/protoactor-go v0.0.0-00010101000000-000000000000

require (
github.com/Workiva/go-datastructures v1.1.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/lithammer/shortuuid/v4 v4.0.0 // indirect
github.com/lmittmann/tint v1.0.3 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/orcaman/concurrent-map v1.0.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.44.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
golang.org/x/sys v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
Binary file not shown.
42 changes: 42 additions & 0 deletions _examples/actor-jaegertracing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
## AI Generated Content. Please report issues

# Go Example: Jaeger Tracing with Proto.Actor

## Introduction
This Go example demonstrates how to integrate Jaeger tracing with the Proto.Actor framework. It provides a practical demonstration of implementing distributed tracing in a microservices architecture using Jaeger.

## Description
The program initializes a Jaeger tracer and sets up a simple actor system with Proto.Actor. It sends messages between actors and traces these interactions using Jaeger. This example is particularly useful for understanding how distributed tracing works in complex systems where understanding the flow of requests and responses is crucial.

## Setup
Ensure you have the following to run this example:
- Go programming environment
- Proto.Actor for Go
- Jaeger Tracing libraries

Install the necessary libraries using:
```bash
go get -u github.com/asynkron/protoactor-go
go get -u github.com/uber/jaeger-client-go
```

## Running the Example

```bash
go run main.go
```

To run the example an instance of Jaeger server is required running locally. The easiest way to run a jaeger server
instance is starting it using the included docker-compose file like this

```bash
docker-compose -f ./examples/jaegertracing/docker-compose.yaml up -d
```


## Additional Notes
- The `initJaeger` function sets up Jaeger tracing with basic configuration.
- The program creates an actor system and uses Jaeger to trace the message flow between actors.
- This example is ideal for those looking to implement distributed tracing in their Go applications using Jaeger and Proto.Actor.

This example is an insightful demonstration of using Jaeger for distributed tracing in a Go application with the Proto.Actor framework.
Loading

0 comments on commit 7f6c6eb

Please sign in to comment.