Skip to content

Ingress Client #33

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

Open
RaghavRox opened this issue Nov 9, 2024 · 4 comments
Open

Ingress Client #33

RaghavRox opened this issue Nov 9, 2024 · 4 comments

Comments

@RaghavRox
Copy link

Something like this, so that handlers can be invoked from places with no access to ctx.

@slinkydeveloper slinkydeveloper changed the title Feat req : Rust restate client without context Ingress Client Dec 9, 2024
@musjj
Copy link

musjj commented Feb 9, 2025

Any chance that we'll get this soon?

@slinkydeveloper
Copy link
Collaborator

Hi, currently I'm not planning to work on this feature, but I accept contributions. In Restate 1.2 (releasing this week) you'll be able to get the OpenAPI of a service, and that can be used to generate a client with any openapi generator. I was just adding the documentation about it: restatedev/documentation#521

@patrickariel
Copy link

I was looking into this, but I'm not sure if my approach makes sense. In my attempt, I created a trait to abstract between a ContextInternal and a (potential) ingress client. The macro would generate something like this:

pub(crate) struct MyObjectClient<'client, T: Client> {
    client: &'client T,
    key: String,
}

But this introduces a breaking change and a bit of an ergonomic hit when creating a client (notice the <_>):

let client = ctx.object_client::<MyObjectClient<_>>("my-key");

What do you think of this approach? Would this be acceptable? Or do you think that the macro should instead generate two separate types of clients, a context and an ingress one?

@slinkydeveloper
Copy link
Collaborator

slinkydeveloper commented Feb 12, 2025

What do you think of this approach? Would this be acceptable? Or do you think that the macro should instead generate two separate types of clients, a context and an ingress one?

I think eventually the macro should generate two clients, because the return types of the methods will be different.

The futures returned by the context methods will change at some point, and they will all implement a custom subtrait of Future (e.g. RestateFuture) which I'll use to implement things like combinators/select statements.

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

4 participants