英文:
Spring Integration AbstractMessageSourceAdvice is deprecated
问题
我正在使用AbstractMessageSourceAdvice
来在轮询文件夹后执行操作,但它已被弃用,替代类是什么,您有教程吗?
这是我的代码:
public class EmptyFolderAdvice extends AbstractMessageSourceAdvice {
private static final Logger LOGGER = LoggerFactory.getLogger(EmptyFolderAdvice.class);
@Override
public Message<?> afterReceive(Message<?> message, MessageSource<?> source) {
if (message == null) {
LOGGER.info("Empty folder, the process will stop");
System.exit(0);
}
return message;
}
}
英文:
I'm using an AbstractMessageSourceAdvice
to achieve an action after polling on a folder but is is deprecated , what is the replacement class to this one and do you have a tutorial.
here is my code :
public class EmptyFolderAdvice extends AbstractMessageSourceAdvice {
private static final Logger LOGGER = LoggerFactory.getLogger(EmptyFolderAdvice.class);
@Override
public Message<?> afterReceive(Message<?> message, MessageSource<?> source) {
if (message == null) {
LOGGER.info("Empty folder , the process will stop");
System.exit(0);
}
return message;
}
Thanks
答案1
得分: 1
I thought it should be very clear from JavaDocs of that deprecated class:
* @deprecated since 5.3 in favor of {@link MessageSourceMutator}.
I don't remember that I recommended you somewhere to use that abstract class: Stack Overflow Question
You definitely don't even need that "mutator" variant: you really don't mutate a message source, but the whole application to make it stop.
It also says that you use some old Spring Integration version. Consider upgrading to the latest one: Spring Integration
Also, please, learn how to ask questions here on Stack Overflow: How to Ask. It is really very hard to read questions with a lot of typos and no proper formatting for code.
英文:
Hm. I thought it should be very clear from JavaDocs of that deprecated class:
* @deprecated since 5.3 in favor of {@link MessageSourceMutator}.
*/
@Deprecated
public abstract class AbstractMessageSourceAdvice implements MessageSourceMutator {
I don't remember that I recommended you somewhere to use that abstract class: https://stackoverflow.com/questions/76515730/spring-integration-stop-gracefully-application-when-no-file-in-directory
You definitely don't even need that "mutator" variant: you really don't mutate a message source, but whole application to make it stop.
It also says that you use some old Spring Integration version. Consider to upgrade to the latest one: https://spring.io/projects/spring-integration#learn
Also, please, learn how to ask questions here on StackOveflow: https://stackoverflow.com/help/how-to-ask. It is really very hard to read questions with a lot of typos and no proper formatting for code.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论