[英]Communication model: C++ and Java
Pals, 帕尔斯,
I have a requirement to establish a communication channel between C++ and Java layer of my application for the exchange of objects and their properties. 我需要在我的应用程序的C ++和Java层之间建立一个通信通道,以交换对象及其属性。
I have got the following options: 我有以下选择:
Can you please advice me the Pros & Cons on these. 你能否告诉我这些优点和缺点。 Please share your experiences on the implementation complexities.
请分享您在实施复杂性方面的经验。
Thanks, Gtk 谢谢,Gtk
If the option is between those I would choose XML 如果选项介于两者之间,我会选择XML
Object <=> XML 对象<=> XML
Java side Simple , C++ side XML Objects Java端简单 ,C ++端XML对象
Reason, its simpler for what you want, ie pass language objects and not Data Base 原因,它更简单的你想要的,即传递语言对象而不是数据库
Ah, could you specify the communication channel between the apps ? 啊,你能指定应用程序之间的通信渠道吗?
UPDATE UPDATE
If you can use JSON I would recommend it instead of XML, here is why . 如果您可以使用JSON我会推荐它而不是XML, 这就是原因 。
Another option would be JMS. 另一种选择是JMS。 There are C++ clients out there.
那里有C ++客户端。
Every time I see XML I think RESTful web service. 每当我看到XML时,我都认为RESTful Web服务。 Both platforms you mentioned have some form of tooling to marshal & unmarshal XML.
您提到的两个平台都有某种形式的工具来编组和解组XML。 There are plenty of working examples out in the wild, so a Google/Bing search is good.
野外有大量工作示例,因此Google / Bing搜索很好。 A nice side-effect is once you have those interfaces built, anything can connect to them.
一个好的副作用是,一旦你建立了这些接口,任何东西都可以连接到它们。
If you really want to bother with generating a WSDL, then feel free to go the SOAP route. 如果您真的想要生成WSDL,那么请随意使用SOAP路由。 However, speaking with several years of web service integration experience, RESTful is so gosh darned simple compared to anything else.
然而,谈到几年的Web服务集成经验,RESTful与其他任何东西相比都非常简单。
I would like to suggest a third option : YAML 我想建议第三种选择:YAML
You have parsing library in YAML for both java and C++. 您在YAML中为java和C ++分析了库。 In my experience, it's easier to debug exchange in YAML that in XML (especially if you got full text field or cyclic data structure).
根据我的经验,在XML中调试YAML中的交换更容易(特别是如果你有全文字段或循环数据结构)。
I depends of the kind of message you transfer. 我取决于您转移的邮件类型。
If your message are individual entity that have a short live, I would go for XML, YAML or something similar. 如果你的消息是短暂的单个实体,我会选择XML,YAML或类似的东西。
If your message contains information that is going to be used later on and refer to information in previous messages, I would use a database. 如果您的消息包含稍后将使用的信息并参考先前消息中的信息,我将使用数据库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.