IPC的RMI替代品? [英] Alternatives to RMI for IPC?

查看:149
本文介绍了IPC的RMI替代品?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个进程需要在同一台PC和不同PC上进行通信.在本地情况下,进程通信是在不同进程之间进行的,例如进程A和进程B.
在远程情况下,它将是在不同PC上运行的Process A的2个实例之一.
我将从头开始创建它们,我想知道什么是最佳方法.我知道RMI和套接字,但是我想知道我所描述的情况,并且考虑到交换的消息很小,并且如果有标准的方法/库,则API的数量确实很小.
强烈欢迎您提出任何建议

I have 2 processes that need to communicate over the same PC and different PCs. In the local case the process communication is among different processes e.g Process A and Process B.
In the remote case it will be among 2 instances of Process A running in different PCs.
I will create them from scratch and I am wondering what is the best approach. I am aware of RMI and sockets but I was wondering for my case as described, and taking also into account that the messages exchanged are small and the number of APIs really small, if there is a standard approach/library for this.
Any suggesstions are highly welcome

在@EJP评论后更新:
我的兴趣是1)以公开方式实现通信的要求,因为所暴露的API很小,消息也是如此2)使用并学习一种新的流行框架(如果可能的话)(我已经知道RMI和套接字)

Update after @EJP comments:
My interest is 1)to implement the requirement for communication in a light manner since the API exposed will be really small and the messages as well 2)use and learn a new popular framework if possible (I already know RMI and sockets)

推荐答案

如果您只是在寻找消息传递框架,则可以使用诸如

If you are just looking for messaging frameworks, there's a bunch available out such as

  • RabbitMQ - http://www.rabbitmq.com/
  • ZeroC Ice - http://www.zeroc.com/ice.html
  • AMQP - http://www.amqp.org
  • OpenSplice DDS - http://www.prismtech.com/opensplice

但是,当您使用第三方框架时,则会向应用程序中添加其他依赖项.如果您的情况很简单,那么编写TCP客户端/服务器就足以满足客户端/服务器范例的需要,或者如果您正在寻找发布者/订户的范例,那么您可以考虑使用UDP多播.如果您希望能够封送和解封数据以使用典型的JAVA套接字API将数据进行缓冲和发送到网络,则只需要将数据类扩展为Serializable.

But when you use a 3rd party framework, you are then adding an additional dependency to your application. If it is something very simple like your case, perhaps writing a TCP client/server would be sufficient for a client/server paradigm or if you are looking for publisher/subscriber paradigm then you can look into using UDP multicast. You just need your data class to extends Serializable if you want to be able to marshal and unmarshal your data to buffer and send it over to network using typical JAVA socket API.

这篇关于IPC的RMI替代品?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆