-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Allow running two IServer implementations side by side #58288
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
Comments
It feels like maybe you want a new transport, in the same way that we added named pipes. Then you'd just have separate endpoints for HTTP and AMQP. Or have I misunderstood your question? |
my project has two parts: plugin system API and AMQP based requests/responses. The project involves creating two APIs, the first will be available on the internet, it will serialize requests and send them via AMQP to the second one, then the message will be processed and the response will be stored as a separate AMQP message on a separate queue. I don't mind having a separate server but would like to know which approach would be better/will perform better. I think that a custom transport should allow me to have both HTTP and AMQP at the same time (I saw that we can have two transports at the same time), but I must admit that the example would help me to get started. |
Can you share a little bit more about what you're doing here? As a general rule, the IServer implementation is optimized for synchronous request-response patterns and would not be a good fit for message-oriented protocols like AMQP. Existing concepts, like caching and auth middleware, don't map directly to a message-oriented implementation. Also, ASP.NET Core doesn't really support running multiple IServer instances at once with any reasonable sharing between them (see #27213). Are you simply just trying to deserialize the request bodies in the AMQP format in your API or is your intent to build a more full-fledged messaging protocol here? |
@captainsafia Sorry for the late reply - writing from a hospital. Currently, the entire solution has two parts:
This was designed this way, to be able to handle long-running operations. When you send a task that will take a long time (for example generating a report or doing a database backup) the server will return a specific HTTP code with the task ID when there is no response from the client within 10 seconds, you can then use the ID to check if the task finished and get the results (separate HTTP method). I'm rewriting the solution to be able to call the same methods locally and via the server (so locally the client will call local API without proxying the requests via RabbitMQ). The idea is quite simple, call REST API via a standard HTTP request or via AMQP message. I could create a hosted service that would handle RabbitMQ messages, but I'm not sure how to create a HttpRequest there, pass it to the application, and handle the response. I hope my idea and request is much easier to understand. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I need to create an API that will allow two types of communication, a standard way using HTTP requests and a second using AMQP messages.
I've implemented a custom IServer and I was able to plug it into the default ASP.NET Core Web API (.NET8) project using:
builder.Services.AddSingleton<IServer, RabbitMqServer>();
but this disables the default communication via HTTP.
I've tried creating a composite server using https://github.com/stop-cran/AspNetCoreExtras.Solace.Server as a reference,
But when I try to start project from VS I get this errors:
I've tried configuring Kestrel via
but this gives me this error:
Describe the solution you'd like
Ideally, we should be able to easily add additional IServer implementations to projects, so they can work side by side.
Additional context
I want to reuse as many features as I can, my idea is to configure authorization, cache, rate limiting, etc in my app and allow invoking requests via HTTP and AMQP.
If there is an easier way to "dispatch" a request from AMQP message and catch the response please let me know.
The text was updated successfully, but these errors were encountered: