Skip to content
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

erreur when reply with HttpResponse with circuit breaker #79

Open
deblockt opened this issue Feb 8, 2019 · 0 comments
Open

erreur when reply with HttpResponse with circuit breaker #79

deblockt opened this issue Feb 8, 2019 · 0 comments

Comments

@deblockt
Copy link

deblockt commented Feb 8, 2019

When we use a circuit breaker with web-client we have this exception:

15:49:40.631 [vert.x-eventloop-thread-6] 83171574-ac36-4212-abc9-f51656734a2a ERROR io.vertx.core.impl.ContextImpl - Unhandled exception
java.lang.NoSuchMethodException: io.vertx.scala.ext.web.client.HttpResponse$.apply(io.vertx.ext.web.client.HttpResponse)
	at java.lang.Class.getMethod(Class.java:1786)
	at io.vertx.lang.scala.Converter$.toScala(Converter.scala:31)
	at io.vertx.scala.core.Future.$anonfun$setHandler$2(Future.scala:57)
	at io.vertx.lang.scala.AsyncResultWrapper.result$lzycompute(AsyncResultWrapper.scala:26)
	at io.vertx.lang.scala.AsyncResultWrapper.result(AsyncResultWrapper.scala:26)
	at com.norauto.api.external.organizationalunit.OUClient.$anonfun$vertxFutureToScalaFuture$1(OUClient.scala:77)
	at io.vertx.scala.core.Future.$anonfun$setHandler$1(Future.scala:57)
	at io.vertx.core.impl.FutureImpl.tryComplete(FutureImpl.java:125)
	at io.vertx.core.impl.FutureImpl.complete(FutureImpl.java:86)
	at io.vertx.circuitbreaker.impl.CircuitBreakerImpl.lambda$null$3(CircuitBreakerImpl.java:220)
	at io.vertx.core.impl.ContextImpl.lambda$wrapTask$2(ContextImpl.java:339)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:163)
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:463)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:886)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)

The code is the following:

breaker.executeCommandFuture[HttpResponse[Buffer]](future => {
    performSomeHttpRequest() onComplete {
      case Success(httpResult) => future.complete(httpResult)
      case Failure(error) => future.fail(error)
    }
})

To fix that, we have encapsulated the HttpResource on a custom class Wrapper.

It seem that this failure occurs because HttpResponse.apply need an implicit type scala.reflect.runtime.universe.TypeTag, and the method toScala doesn't support that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant