The default connection timeout for a RabbitMQ factory connection is 600 seconds (at least in the Java API), so your 10 minutes. You can change this by pointing to the factory connection your choice timeout.
It is good practice to ensure that your connection is released and recreated after a certain amount of time to prevent possible leaks and excessive resources. Your code must ensure that it searches for the correct connection that is not close to the timeout, and re-establish a new connection with those that timed out. In general, take the channel aggregation approach.
- Java example:
ConnectionFactory factory = new ConnectionFactory(); factory.setHost(this.serverName); factory.setPort(this.serverPort); factory.setUsername(this.userName); factory.setPassword(this.userPassword); factory.setConnectionTimeout( YOUR-TIMEOUT-IN-SECONDS ); Connection = factory.newConnection();
gextra
source share