I'm migrating a JBoss EAP application to Quarkus. My application has multiple implementations of the same REST service interface for failover/fallback scenarios:
ManagerClientImpl- Primary HTTP client (calls external service)ManagerClientBackup- Local fallback implementation
Both classes implement the same interface:
@Path("/rate")
public interface Service {
@GET
@Path("/convert")
@Produces("application/json")
Amount convert(@QueryParam("param") String param, ...);
}
The ErrorWhen building with Quarkus, I get:[ERROR] GET /rate is declared by:
[ERROR] ManagerClientImpl#convert
[ERROR] ManagerClientBackup#convert
[ERROR] at io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor.checkForDuplicateEndpoint(ResteasyReactiveProcessor.java:1504) [ERROR] at io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor.setupEndpoints(ResteasyReactiveProcessor.java:731)
In JBoss, this configuration works fine.
Cannot significantly change existing architecture. Both implementations must exist in the JAR (for producer pattern which is needed for our failover(backup) strategy)
Update:
I have tried 2 solution which didnt work for my case
1.@EndpointDisabled - Doesn't prevent REST endpoint discovery, only disables at runtime
- @Alternative + @Priority + BuildProperty annotation - This will work but endpoints discovered at build time
Is there a way in Quarkus to Keep both implementations as REST endpoints in the build Have only ONE actually registered/available at runtime based on CDI producer selection or we if we have any configuration in which I can change it in run time so that when we need to backup solution I can switch to that in run time.