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

Experimenting with Kotlin Actors #72

Open
idugalic opened this issue Feb 19, 2022 · 1 comment
Open

Experimenting with Kotlin Actors #72

idugalic opened this issue Feb 19, 2022 · 1 comment

Comments

@idugalic
Copy link
Member

Notice that pull request is already merged #70

This issue is going to track further progress (evolution) of this experimental API in FModel library.

Experimenting with Kotlin Actors - concurrently handling messages by confining the shared state effects.

fun <C, S, E> EventSourcingAggregate<C, S, E>.handleConcurrently(
    commands: Flow<C>,
    numberOfActors: Int = 100,
    actorsCapacity: Int = Channel.BUFFERED,
    actorsStart: CoroutineStart = CoroutineStart.LAZY,
    actorsContext: CoroutineContext = EmptyCoroutineContext,
    partitionKey: (C) -> Int
): Flow<E>

Extension function - Handles the Flow of messages by concurrently distributing the load across a finite number of actors/handlers. partitionKey function enables you to choose which messages need to be handled sequentially and which could be handled concurrently.

Notice, the API is experimental and depends on Kotlin Actor ObsoleteCoroutinesApi. The API is available only on jvm target.

@idugalic
Copy link
Member Author

#70 - merged

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

No branches or pull requests

1 participant