简体   繁体   English

如何在分布式环境中发送文件内容?

[英]How to send file content in distributed environment?

I have the following scenario: 我有以下场景:

Two Java applications use ActiveMQ for communication.They use a publisher/subscription model. 两个Java应用程序使用ActiveMQ进行通信。它们使用发布者/订阅模型。

One application has some physical files, and the other one should request the file content. 一个应用程序有一些物理文件,另一个应该请求文件内容。 What is the best way of sending the file? 发送文件的最佳方式是什么? One idea should be reading the file in memory in a byte array and to serializate the array, and send the file content in a message . 一个想法应该是在字节数组中读取内存中的文件并序列化数组,并在消息中发送文件内容。 Do you have any other ideas? 你还有其他建议吗?

Thanks in advance. 提前致谢。

Depends how big your files is? 取决于你的文件有多大? If they are not so big, then yeah you can transfer them as JMS messages. 如果它们不是那么大,那么你可以将它们作为JMS消息传输。

If big files, you can use off-band. 如果是大文件,可以使用带外。 See this link also: 请看这个链接:

You could always use the normal ways to distribute a file. 您始终可以使用常规方式分发文件。 I would not suggest using ways to transfer the whole file (email, copy, enclos the file in a message) but this depends on the usage of the file. 我不建议使用方法来传输整个文件(电子邮件,复制,将文件包含在邮件中),但这取决于文件的用法。 Sharing a file would probably be the simplest and most efficient solution. 共享文件可能是最简单,最有效的解决方案。 You should also take into account, what are you going to do with this file. 您还应该考虑到,您要对此文件做什么。 Do you want it to be randomly accessed? 你想让它随机访问吗? Do you really need to trasfer it as a whole? 你真的需要整体转移它吗?

You could also consider using Hadoop . 您还可以考虑使用Hadoop Hadoop is a distributed system's framework which is oriented towards highly localized data. Hadoop是一个分布式系统的框架,面向高度本地化的数据。 It also gives you have a distributed file system (HFS). 它还为您提供了分布式文件系统(HFS)。

Hope I helped! 希望我帮忙!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM