aws 出站通道适配器上的建议处理程序

advice handler on aws outbound channel adapter

过去,我能够在不同的出站通道适配器上应用建议链处理程序。我试图在 int-aws:s3-outbound-channel-adapter 上做同样的事情,但它不允许这样做。此组件是否不允许此行为。基本上我有兴趣了解适配器何时完成将文件上传到 S3。

<int-aws:s3-outbound-channel-adapter
    id="s3-outbound" channel="files" bucket="${s3.bucket}"
    multipart-upload-threshold="5192" remote-directory="${s3.remote.dir}"
    accessKey="${accessKey}" secretKey="${secretKey}">

    THIS DOESNT WORKS - throws an error !!!
    <int:request-handler-advice-chain>
    </int:request-handler-advice-chain> 

</int-aws:s3-outbound-channel-adapter>

是的,XSD 不允许这样做。欢迎就此事提出 JIRA

不过根本不管用也没关系

如果您已经在 Spring 集成 4.x 上,您可以使用 @Bean 和 [=12 将 <int-aws:s3-outbound-channel-adapter> 移动到 Java 和注释配置=] 对于 AmazonS3MessageHandler.

其中 @ServiceActivator 具有 adviceChain 属性以指定对您的 Advice 的 bean 引用。

... 或者您可以使用通用 <int:outbound-channel-adapter> 并将 AmazonS3MessageHandler 指定为第一个 ref 的原始 <bean>。 HTH