Reputation: 197
I have application.yml configuration i.e
cloud:
stream:
poller:
# Cron for polling data.
cron: 0 0/30 * * * *
........
I am facing errors like
Description:
The following configuration properties are mutually exclusive:
spring.integration.poller.cron
spring.integration.poller.fixed-delay
spring.integration.poller.fixed-rate
However, more than one of those properties has been configured at the same time:
spring.integration.poller.cron
spring.integration.poller.fixed-delay
Action:
Update your configuration so that only one of the mutually exclusive properties is configured.
Even though I haven't added fix-delay it shows that I have added it.
I saw that PollerConfigEnvironmentPostProcessor class adds fixed-delay
if the property is absent. So how can I use the cron expression?
//TODO Must remain after removal of deprecated code above in the future
streamPollerProperties.putIfAbsent(INTEGRATION_PROPERTY_PREFIX + "fixed-delay", "1s");
streamPollerProperties.putIfAbsent(INTEGRATION_PROPERTY_PREFIX + "max-messages-per-poll", "1");
I have also checked with spring integration poller properties instead of spring cloud stream poller as it is deprecated but getting the same error
integration:
poller:
cron: 0 0/30 * * * *
Earlier with spring cloud version 2020.0.2, it was working fine. As soon as I update the spring cloud version to 2021.0.1, error gets started
Upvotes: 1
Views: 512
Reputation: 121542
This is bug. That:
streamPollerProperties.putIfAbsent(INTEGRATION_PROPERTY_PREFIX + "fixed-delay", "1s");
has to be conditional if there is no spring.integration.poller.fixed-delay
or spring.integration.poller.cron
present yet.
As a workaround I suggest to implement an EnvironmentPostProcessor
like this:
public class RemoveStreamPollerEnvironmentPostProcessor implements EnvironmentPostProcessor {
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
environment.getPropertySources().remove("spring.integration.poller");
}
}
This way all the spring.integration.poller.
properties related to Spring Cloud Stream will be removed from the environment. But those configured manually based on the spring.integration.poller.
will still be present.
Therefore your:
spring:
integration:
poller:
cron: 0 0/30 * * * *
will be good.
NOTE: the EnvironmentPostProcessor
has to be registered in the spring.factories
.
Upvotes: 2