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

feat!: add support for bounded/unbounded mailboxes #29

Merged
merged 8 commits into from
Jun 11, 2024

Conversation

tqwewe
Copy link
Owner

@tqwewe tqwewe commented Jun 6, 2024

Closes #3 and #28

This PR changes how the fundamentals of kameo works, but adds support for choosing the boundedness of actor mailboxes. The actor mailbox can be set when implementing Actor with the type Mailbox = BoundedMailbox<Self> or UnboundedMailbox<Self> associated type.

As unbounded channels differ in asyncness than bounded channels, a new builder syntax has been introduced when sending messages to actors. The types are AskRequest, TellRequest, and QueryRequest. These are returned an ActorRef's with the .ask(...), .tell(...), .query(...) methods, and support customizing timeouts.

Sending a message with a reply would look like my_actor_ref.ask(Foo { ... }).send().await?;, and sending a message without a reply looks like my_actor_ref.tell(Foo { ... }).send().await?;

@tqwewe tqwewe merged commit 958c01e into main Jun 11, 2024
@tqwewe tqwewe deleted the feat/bounded-mailbox branch June 11, 2024 07:25
@tqwewe tqwewe mentioned this pull request Jun 11, 2024
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.

unbounded channel usage
1 participant