Reputation: 1140
I wrote the following configuration:
@Slf4j
@Configuration
@EnableConfigurationProperties(BatchProperties.class)
public class BatchConfiguration {
@Autowired
private BatchProperties properties;
@Bean
public PollableAmqpChannel testingChannel(final RabbitTemplate rabbitTemplate) {
final PollableAmqpChannel channel = new PollableAmqpChannel(properties.getQueue(), rabbitTemplate);
channel.setLoggingEnabled(false);
return channel;
}
@Bean
@ServiceActivator(inputChannel = "testingChannel", poller = @Poller(fixedRate = "1000", maxMessagesPerPoll = "1"))
public MessageHandler messageHandler(final RabbitTemplate rabbitTemplate) {
return message -> {
log.info("Received: {}", message);
rabbitTemplate.convertAndSend(properties.getQueue(), message);
};
}
}
Message gets successfully read and requeued but I keep getting the following message:
Calling receive with a timeout value on PollableAmqpChannel. The timeout will be ignored since no receive timeout is supported.
I am using Spring Boot 1.5.3.RELASE.
I've put a breakpoint on :
@Override
public void setLoggingEnabled(boolean loggingEnabled) {
this.loggingEnabled = loggingEnabled;
}
in the AbstractAmqpChannel
class. It gets called with 'false' (as it should according to my configuration) and then it gets called again each time it polls a message and it is set to 'true'.
I checked the hashcode and it seems it is my bean, but 'loggingEnabled' gets reset to 'true' with each message.
Is there something wrong with my configuration and how can I fix this?
Upvotes: 1
Views: 119
Reputation: 174769
It looks like a bug - if you have spring-integration-jmx
on the classpath, or specify @EnableIntegrationManagement
on one of your config classes; the IntegrationManagementConfigurer
bean sets logging enabled to true for all IntegrationManagement
implementations, overwriting your setting.
Please open a JIRA Issue.
In the meantime, you could add a bean that implements SmartLifecyle
to set the flag back to false (in the start()
method); it will run after the IntegrationManagementConfigurer
.
Of course, you could also set the log category org.springframework.integration.amqp.channel.PollableAmqpChannel
to WARN
to achieve the same effect much simpler.
Upvotes: 1