gpt4 book ai didi

java - 如何在Camel 3.0上添加附件

转载 作者:行者123 更新时间:2023-12-01 19:32:25 24 4
gpt4 key购买 nike

在 Camel 2.x 中,我可以向消息添加附件,例如:

exchange.getOut().addAttachment("LogFile.log.gz", new DataHandler(Base64.decodeBase64(FileContentBase64),"application/x-gzip"));

但是在Camel 3.0中这是不可能的。我按照迁移指南所述更改了代码:

exchange.getMessage().addAttachment("LogFile.log.gz", new DataHandler(Base64.decodeBase64(FileContentBase64),"application/x-gzip"));

但是它不起作用。这也不是:

exchange.getIn().addAttachment("LogFile.log.gz", new DataHandler(Base64.decodeBase64(FileContentBase64),"application/x-gzip"));

有人有想法来解决这个问题。

我想通过电子邮件发送此附件。

最佳答案

Camel 版本 3 进行了很多模块化。因此,附件 API 已被提取,并且必须以不同的方式使用,请参阅 Camel 3 Migration Guide :

The attachments API (javax.activation) has been moved out of org.apache.camel.message into an extension org.apache.camel.attachment.AttachmentMessage from the camel-attachments JAR.

To use this API you can get it via the getMessage method on Exchange:

AttachmentMessage am = exchange.getMessage(AttachmentMessage.class); am.addAttachment("myAtt", new DataHandler(...)); 

关于java - 如何在Camel 3.0上添加附件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59211228/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com