通过MSMQ发送文件 [英] Sending files over MSMQ

查看:461
本文介绍了通过MSMQ发送文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在零售场景中,每家商店在每天结束时将其每日交易报告给后端系统。今天,由日常事务和一些其他元信息组成的文件将通过FTP从商店传输到后端。我目前正在研究用别的东西替换FTP。 MSMQ已被建议作为替代运输机制。所以我的问题是,我们是否需要编写一个自定义Windows服务,将日常事务文件粘贴到消息对象中,并将其发送到它的路上,或者MSMQ中有任何out-box机制来处理它?<​​/ p>

此外,如果我们排除MSMQ,我们想要传输的文件可以达到5-6 Mb的大型商店?在那种情况下,我们应该研究其他建议的技术吗?



干杯!

解决方案

NServiceBus提供了一个很好的MSMQ抽象像这样的情况。您可以获得MSMQ的可靠消息传递方面的信息,以及用于定义消息的非常好的编程模型。

然而,MSMQ限于4MB的消息大小,有两种方法可以在NServiceBus中处理这个问题:


  1. NServiceBus有一个叫做数据总线的概念,它将消息中的大附件使用其他方法可靠地传输它们。这是由基础架构处理的,就您的消息处理程序而言,数据就在那里。

  2. 您可以将有效负载拆分为更小的原子消息并将其作为普通消息发送。 NServiceBus基础设施将确保它们都到达目的地并进行处理。我会推荐这种方法,除非将整个大型数据转储作为一个原子事务进行处理是绝对关键的。

另一个需要注意的事项是你夜间转储的事实可能是以前系统的限制。使用NServiceBus可以改变系统,使得这些信息以更直接的方式发送,这将导致更多的最新数据,这对业务来说可能是一个巨大的胜利。

In a retail scenario where each stores report their daily transaction to the backend system at the end of the day. Today a file consisting of the daily transactions and some other meta information is transferred from the stores to the backend using FTP. I’m currently investigating replacing FTP with something else. MSMQ has been suggested as an alternative transport mechanism. So my question is, do we need to write a custom windows service that sticks the daily transactions file into a message object and sends it on its way or is there any out the box mechanism in MSMQ to handle this?

Also, since the files we want to transfer can reach 5-6 Mb for large stores should we rule out MSMQ? In that case is there any other suggested technologies we should investigate?

Cheers!

解决方案

NServiceBus provides a nice abstraction over MSMQ for situations like this. You get the reliable messaging aspects of MSMQ, along with a very nice programming model for defining your messages.

MSMQ is limited to a 4MB message size, however, and there are two ways you could deal with this in NServiceBus:

  1. NServiceBus has a concept called the Data Bus, which takes the large attachments in your messages and transmits them reliably using another method. This is handled by the infrastructure and as far as your message handlers are concerned, the data is just there.
  2. You could break up the payload into smaller atomic messages and send them as normal messages. The NServiceBus infrastructure would ensure that they all arrive at their destination and are processed. I would recommend this method unless it's absolutely critical that the entire huge data dump is processed as one atomic transaction.

One other thing to note is that the fact that you do nightly dumps is probably a limitation of a previous system. With NServiceBus it may be possible to change the system so that these bits of information are sent in a more immediate fashion, which will result in much more up-to-date data all the time, which may be a big win for the business.

这篇关于通过MSMQ发送文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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