Skip to content

Using C++20 coroutines to handle messages in agents #102

@matveigavrilov1

Description

@matveigavrilov1

Hello! Have you considered using coroutines to process messages in agents? It would be good solution for waiting messages with saving context.

Something like that

class SomeAgent: public agent_t
{
// ...

coro_type sendRequestWaitResponse()
{
    so_5::send<Request>(someMbox);
    auto response = co_await so_5::receive<Response>(someMbox);
    // handle response
}

//...
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions