apple / swift-distributed-actors

Peer-to-peer cluster implementation for Swift Distributed Actors
https://apple.github.io/swift-distributed-actors/
Apache License 2.0
587 stars 55 forks source link

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

Open ktoso opened 1 year ago

ktoso commented 1 year ago

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.