Another mini sample to show starting two processes and discovery#1139
Open
ktoso wants to merge 1 commit intoapple:mainfrom
Open
Another mini sample to show starting two processes and discovery#1139ktoso wants to merge 1 commit intoapple:mainfrom
ktoso wants to merge 1 commit intoapple:mainfrom
Conversation
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) ```
akbashev
reviewed
Oct 4, 2023
| 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) |
lyzkov
reviewed
Aug 5, 2024
| } | ||
|
|
||
| try? await Task.sleep(for: .seconds(60)) | ||
| _ = p |
There was a problem hiding this comment.
_ = p changes nothing and means nothing, breaking Occam's Razor principle. The _ = p definition exists only to suppress compiler warnings. Are there any other ways of retaining Person instance without declaring an unused constant? autoreleasepool?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To see this in action do:
and in another process
The actors discover and greet eachother then:
Motivation:
An even more simple 2 process example to showcase discovery.