amqp-client icon indicating copy to clipboard operation
amqp-client copied to clipboard

Getting future timeout exception which creating a consumer/producer

Open anindyaju99 opened this issue 10 years ago • 2 comments

Hi,

We have one ConnectionOwner. On top of that we are creating 7-8 queues. For each queue we have one producer and one consumer (on the same ConnectionOwner).

This is how we create the connection owner.

val connectionFactory = new ConnectionFactory() connectionFactory.setAutomaticRecoveryEnabled(true) connectionFactory.setTopologyRecoveryEnabled(true) connectionFactory.setVirtualHost(config.vhost) connectionFactory.setNetworkRecoveryInterval(5) connectionFactory.setPassword(config.pass) connectionFactory.setUsername(config.user) connectionFactory.setSharedExecutor(Executors.newFixedThreadPool(Runtime.getRuntime.availableProcessors() * 4)) val addresses = config.hosts.map( h => { val tokens = h.split(":") new Address(tokens(0), tokens(1).toInt) }).toArray connection = system.actorOf(ConnectionOwner.props(connectionFactory, 1 second, addresses = Option(addresses)))

The trace looks like this -

java.util.concurrent.TimeoutException: Futures timed out after [5000 milliseconds] at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) ~[dispatcher-service.jar:1.14-SNAPSHOT] at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) ~[dispatcher-service.jar:1.14-SNAPSHOT] at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190) ~[dispatcher-service.jar:1.14-SNAPSHOT] at akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThread$$anon$3.block(ThreadPoolBuilder.scala:169) ~[dispatcher-service.jar:1.14-SNAPSHOT] at scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:3640) [dispatcher-service.jar:1.14-SNAPSHOT] at akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThread.blockOn(ThreadPoolBuilder.scala:167) ~[dispatcher-service.jar:1.14-SNAPSHOT] at scala.concurrent.Await$.result(package.scala:190) ~[dispatcher-service.jar:1.14-SNAPSHOT] at com.github.sstone.amqp.ConnectionOwner$.createChildActor(ConnectionOwner.scala:32) ~[dispatcher-service.jar:1.14-SNAPSHOT] at com.olacabs.dispatcher.rmq.RabbitMQConnectionHelper$.createProducer(RabbitMQConnectionHelper.scala:115) ~[dispatcher-service.jar:1.14-SNAPSHOT]

anindyaju99 avatar Dec 22 '15 09:12 anindyaju99

Hi, Can you throw some light on this issue?

anindyaju99 avatar Dec 23 '15 18:12 anindyaju99

Hi and Happy Christmas, It seems that your createProducer function is asking the connection actor to create a child channel actor, and it times out. The code that you use to create the connection actor looks fine too me, is there a way you could extract some code from your helper classes and build a small, self-contained sample ? Thanks!

sstone avatar Dec 26 '15 11:12 sstone