1

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

  1. @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.

Stack trace:

[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:3.20.1.redhat-00003:build (default) on project acs-quarkus-authentication-service: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [ERROR] [error]: Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: [ERROR] GET /useragent is declared by : [ERROR] com.worldline.acs.utils.babel.client.useragent.UserAgentParserClientBackup#parse consumes *, produces application/json [ERROR] com.worldline.acs.utils.babel.client.useragent.UserAgentParserClientImpl#parse consumes *, produces application/json [ERROR] DELETE /proxy/v2 is declared by : [ERROR] com.worldline.acs.hubs.mock.RestProxyManagerV2MockImpl#deleteAuthentication consumes application/json, produces application/json [ERROR] com.worldline.acs.hubs.client.proxyImpl.RestProxyBackupManagerV2Impl#deleteAuthentication consumes application/json, produces application/json [ERROR] GET /iptolocation is declared by : [ERROR] com.worldline.acs.utils.babel.client.iptolocation.IpToLocationManagerClientBackup#locate consumes *, produces application/json [ERROR] com.worldline.acs.utils.babel.client.iptolocation.IpToLocationManagerClientImpl#locate consumes *, produces application/json [ERROR] [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) [ERROR] at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) [ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:856) [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:255) [ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654) [ERROR] at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594) [ERROR] at java.base/java.lang.Thread.run(Thread.java:840) [ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:499) [ERROR] ->

6
  • 1
    I would need more information about this in order to be able to help Commented Nov 21 at 14:16
  • Please let me know what additional information you need. Commented Nov 21 at 18:52
  • 1
    For starters, the entire stacktrace Commented Nov 24 at 9:34
  • I have shared the error but I have resolved this issue using second solution I have updated in question but that is for build time and this will remove one of the implementation from jar . 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. Commented Nov 24 at 9:52
  • 1
    I don't remember any way to do this currently. Please open an issue, including some example code of what exactly you hope to see Commented Nov 24 at 11:46

1 Answer 1

3

Issue is resolved after using quarkus.rest.fail-on-duplicate=false configuration suggested by @geonand.

Thank you for the help.

Check this url for more information https://github.com/quarkusio/quarkus/issues/51203

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.