我是一名学生,目前正在研究通过DDS传输文件的方法。我已经在ubuntu终端上运行了dds 6.3版本,并成功发布和订阅。问题是我想要编辑消息,类似地,我想在消息中传输文件。有谁能帮我吗?我将不胜感激
发布于 2015-05-13 22:27:31
这个答案不是特定于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概念空间中看待事情。
https://stackoverflow.com/questions/23800879
复制相似问题