Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another mini sample to show starting two processes and discovery #1139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Sep 21, 2023

To see this in action do:

swift run --package-path Samples/ SamplePair first

and in another process

swift run --package-path Samples/ SamplePair second

The actors discover and greet eachother then:

===-----------------------------------------------------===
|        Sample App Showing Two Actors Talking            |
|                                                         |
| USAGE: swift run SamplePair first|second                |
===-----------------------------------------------------===
[first-actor on sact://system@127.0.0.1:1111] Received message: Hello
from Person(/user/Person-b["$receptionID": "*", "$path":
/user/Person-b]) on sact://system@127.0.0.1:2222!
[first-actor on sact://system@127.0.0.1:1111] Found:
Person(sact://system@127.0.0.1:2222/user/Person-b)

Motivation:

An even more simple 2 process example to showcase discovery.

To see this in action do:

```
swift run --package-path Samples/ SamplePair first
```
and in another process

```
swift run --package-path Samples/ SamplePair second
```

The actors discover and greet eachother then:

```
===-----------------------------------------------------===
|        Sample App Showing Two Actors Talking            |
|                                                         |
| USAGE: swift run SamplePair first|second                |
===-----------------------------------------------------===
[first-actor on sact://system@127.0.0.1:1111] Received message: Hello
from Person(/user/Person-b["$receptionID": "*", "$path":
/user/Person-b]) on sact://system@127.0.0.1:2222!
[first-actor on sact://system@127.0.0.1:1111] Found:
Person(sact://system@127.0.0.1:2222/user/Person-b)

```
system.cluster.join(host: "127.0.0.1", port: firstPort)

try! await system.cluster.joined(within: .seconds(10))
let p = await Person(name: "first-actor", actorSystem: system)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess second-actor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants