[英]Spring integration: no such method exception for custom inbound channel adapter
I am trying to invoke processMessage<\/code> method from my
As2MessageHandler<\/code> class as my entry point into spring integration using a custom inbound-channel-adapter.
我正在尝试从我的
As2MessageHandler<\/code>类调用
processMessage<\/code>方法作为我使用自定义入站通道适配器进入 spring 集成的入口点。
But I keep getting this error saying it can't find the method when it is clearly in the class:
但是我一直收到这个错误,说当它明显在类中时找不到该方法:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'as2.source': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: no such method 'processMessage' is available on class com.as2example.myexample.handler.As2MessageHandler<\/code>
as2MessageHandler class: as2MessageHandler 类:
@Component
public class As2MessageHandler extends AbstractProcessorModule implements IProcessorStorageModule {
private static final Logger LOGGER = LoggerFactory.getLogger(As2MessageHandler.class);
@Override
public boolean canHandle(@Nonnull String s, @Nonnull IMessage iMessage, @Nullable Map<String, Object> map) {
LOGGER.info(" Handle Info:" + s);
return s.equals(DO_STORE);
}
@Override
public void handle(@Nonnull String s, @Nonnull IMessage iMessage, @Nullable Map<String, Object> map) throws AS2Exception {
LOGGER.info("----- AS2 MESSAGE RECEIVED !!! ------");
LOGGER.info(iMessage.getContentType());
LOGGER.info(iMessage.getContentDisposition());
LOGGER.info(iMessage.getAsString());
processMessage(iMessage);
}
public String processMessage(IMessage message) {
LOGGER.info("BEGIN PROCESSING MESSAGE");
return message.getAsString();
}
}
The error is correct.错误是正确的。 It might mislead a little bit since the signature of the method is wrong, not its presence.
由于方法的签名是错误的,而不是它的存在,它可能会产生一点误导。 So, since an inbound channel adapter is a beginning of the flow, there really cannot be any input to the method to produce data for messages.
因此,由于入站通道适配器是流程的开始,因此该方法实际上不能有任何输入来为消息生成数据。 Therefore it is not clear what is your expectation with that
IMessage
as an input for the method.因此,尚不清楚您对该
IMessage
作为该方法的输入的期望是什么。
It is not clear what is your design, but the POJO method in the <int:inbound-channel-adapter>
is invoked by the poller as a source of data for the message.不清楚您的设计是什么,但轮询器调用
<int:inbound-channel-adapter>
中的 POJO 方法作为消息的数据源。 In other words the POJO method as a source must not have arguments - only return.换句话说,作为源的 POJO 方法不能有参数 - 只有返回。 That's why that exception is thrown.
这就是抛出异常的原因。
I don't see anything in your As2MessageHandler
which could server as a source for messages in the inbound channel adapter.我在您的
As2MessageHandler
不到任何可以作为入站通道适配器中消息源的内容。 This one looks more like a service activator.这个看起来更像是一个服务激活器。 Please, revise your design in favor of something else what really may be used as a source of data in that AS2 protocol.
请修改您的设计以支持其他真正可用作该 AS2 协议中的数据源的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.