【发布时间】:2014-05-22 07:53:53
【问题描述】:
我是一名学生,目前正在研究通过 DDS 传输文件的方法。我在 ubuntu 终端上运行了 dds 6.3 版并成功发布和订阅。问题是我想编辑消息,同样我想在消息中传输文件。有没有人可以帮助我?将不胜感激
【问题讨论】:
标签: file publish data-distribution-service opensplice
我是一名学生,目前正在研究通过 DDS 传输文件的方法。我在 ubuntu 终端上运行了 dds 6.3 版并成功发布和订阅。问题是我想编辑消息,同样我想在消息中传输文件。有没有人可以帮助我?将不胜感激
【问题讨论】:
标签: file publish data-distribution-service opensplice
这个答案不是特定于 opensplice 的,它是通用的 DDS。
您不是在发送消息,而是在发布一个实例。如果要编辑实例,请执行此操作并再次发布。这个重新发布的实例可能来自原始发布者实体,也可能来自接收它、编辑它然后重新发布它的订阅者。
伪idl:
enum ObjectiveState {
OS_Desire, // "I need this"
OS_Can, // "I am able to supply this"
OS_Can_Not, // "I am not able to supply this"
OS_In_Process, // "I am doing this"
OS_Complete, // "I did this"
OS_Failed, // "Tried, but unable to complete, try again maybe?"
OS_PermanentFail // "Tried, but can't complete."
};
struct FileTxReq {
long long reqid; //@key
DestinationNode dest; // idl not supplied, some GUID thing
string<256> sourceUri;
string<256> destUri;
ObjectiveState state;
};
然后系统 A 会在 FileRequestTopic 上发布一个样本:
reqid: 0x1234
dest: {systemA}
sourceUri: "/store/publicfiles/theImageFile.jpg"
destUri: "/Users/me/drop/theImageFile.jpg"
state: OS_Desire
系统 B 将订阅 FileRequestTopic,因为它有一个文件存储。它查找、找到请求的 uri,然后发布
reqid: 0x1234 (note this is the same reqid as received)
dest: {systemA} (note this is also copied from the received instance)
sourceUri: "/store/publicfiles/theImageFile.jpg" (also the same)
destUri: "/Users/me/drop/theImageFile.jpg" (also the same)
state: OS_Can
系统 B 启动 sftp 传输并按上述方式发布,但现在状态为“OS_In_Process”。当 sftp 完成时,它会发布一个“OS_Complete”(或两个“OS_Failed”状态之一)示例。
我知道这是一个老问题,但它可能仍然有助于人们了解如何使用 DDS 完成事情,或者如何在 DDS 概念空间中看待事情。
【讨论】: