Anomaly interpretation
In a high concurrency scenario, the number of channels reaches the limit, so they cannot continue to be created
Self-built rabbitmq solution
1. Custom configuration
@Configuration
@Slf4j
public class RabbitMQConfig {
@Bean
public RabbitTemplate rabbitTemplate(final ConnectionFactory connectionFactory) {
CachingConnectionFactory cachingConnectionFactory = (CachingConnectionFactory) connectionFactory;
// set ChannelMax as 4095
cachingConnectionFactory.getRabbitConnectionFactory().setRequestedChannelMax(4095);
final RabbitTemplate rabbitTemplate = new RabbitTemplate(cachingConnectionFactory);
rabbitTemplate.setMessageConverter(jackson2MessageConverter());
rabbitTemplate.setMandatory(true);
rabbitTemplate.setConfirmCallback((correlationData, b, s) -> {
if(!b){
log.error("confirmCallBack Sending failed data: {}",correlationData);
log.error("confirmCallBack Confirmation status: {}",b);
log.error("ConfirmCallBack Reason for sending failure: {}",s);
}
});
rabbitTemplate.setReturnCallback((message, i, s, s1, s2) -> {
log.error("returnCallBack message: {}",message);
log.error("returnCallBack response code: {}",i);
log.error("returnCallBack response message: {}",s);
log.error("returnCallBack Switch: {}",s1);
log.error("returnCallBack Routing Key.{}",s2);
});
return rabbitTemplate;
}
@Bean
public Jackson2JsonMessageConverter jackson2MessageConverter() {
return new Jackson2JsonMessageConverter();
}
}
2. Modify the configuration of MQ server synchronously
rabbitmq.conf
## Set the max permissible number of channels per connection.
## 0 means "no limit".
##In the configuration file, just enter the following parameters and the value you want to set, if you don't use 2047, then you don't need to configure
# channel_max = 128
Rabbitmq solution for cloud services
For paid versions of MQ cloud services, you can try the following to configure rabbitMq connection caching
springBoot 2.3+
rabbitmq:
cache:
connection:
size: 1000
channel:
size: 64
Read More:
- Springboot controls the startup of rabbitmq through configuration files
- [Solved] WebFlux Error: DataBufferLimitException: Part headers exceeded the memory usage limit of 8192 bytes
- Springboot Files Upload Limit Error: The field file exceeds its maximum permitted size of 1048576 bytes
- [Solved] RabbitMQ Error: Error creating bean with name ‘rabbitConnectionFactory‘ defined in class path resource
- Springboot integration RabbitMQ times error: Failed to check/redeclare auto-delete queue(s).
- [Solved] JAVA Connect rabbitMQ Error: An unexpected connection driver error occured
- [Solved] IDEA mvn Error: GC overhead limit exceeded
- [Solved] Rabbitmq injection failed, bean creation failed, error creating bean with name ‘rabbitconnectionfactory’‘
- [Solved] ZK Connect Error: A JNI error has occurred, please check your installation and try again
- JAVA error: java.lang.OutOfMemoryError:GC overhead limit exceeded
- [Solved] JAVA Error: Error:A JNI error has occurred,please check your installation and try again
- [Solved] Eclipse Error: A JNI error has occurred, please check your installation and try again
- [Solved] Error: A JNI error has occurred, please check your installation and try again
- [Solved] Error: A JNI error has occurred, please check your installation and try again Exception in thread
- [Solved] PageHelper Error: syntax error, error in :‘it 1 LIMIT ? ‘
- Android Compile Error: “SSL error when connecting to the Jack server. Try ‘jack-diagnose‘”
- [Solved] JNI Error: ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
- Mongodb java version 3.X, prompt “XXX (an encryption algorithm) is not available” when there is a user name and password
- [Solved] Kafka Error: is/are not present and missingTopicsFatal is true
- Springboot startup error: err config is disabled command (Redis Disables Config command)