Partilhar via


MSMQ and Silverlight - pardon?

I was stalking the MSMQ topic on Twitter and found someone bemoaning the absence of MSMQ in Silverlight. This did cause me to reassess my (very limited) concept of what Silverlight actually was - a system for generating pretty graphical apps that competes with Adobe's Flash. Basically I found I had no idea what Silverlight could, or could not, do.

According to the Microsoft site, "Silverlight helps you create rich web applications that run on Mac OS, Windows, and Linux. Welcome to a new level of engaging, rich, safe, secure, and scalable cross-platform experience." and this helps to explain why MSMQ is not currently supported.

Bryant Likes on the Silverlight forum explained why quite succinctly:

MSMQ has a couple of issues that I think will prevent it from being accessible by Silverlight:

  1. MSMQ is Windows-only; Microsoft is trying to make Silverlight cross-platform.
  2. MSMQ takes quite a bit of code on the client. Silverlight is a 4MB download and I don't think there are plans to grow that size.
  3. Giving a browser application access to a service like MSMQ would also be a security risk and since users aren't very familiar with MSMQ (or at least not as familiar with them as files) it would be very hard to get them to understand what it is doing. Kind of hard to say "this application is trying to access the queue MyComputer\SomeMessageQueue, do you want to allow this access?".

You could try to implement something MSMQ-like using isolated storage by queuing up messages going out and storing incoming messages there before processing them. Not a perfect solution, but it works today.

I would add a 4th - On Windows, MSMQ is not installed by default and is not available on Windows XP Home.

I have, though, passed the suggestion onto the product groups to see what they think.

Comments

  • Anonymous
    November 05, 2009
    It would be a pity for Silverlight to be lacking as a choice where an architecture requires a durable 'store and forward' one way messaging solution. I hope that SL's potential to fill the role of smart client in the browser is not negated by it's inability to address the desktop adequately. For highly available, reliable and scalable systems where one way messaging is used extensively, SL is not an option right now. Perhaps at point of deployment SL apps could be configured to make the most of a windows client if specified?

  • Anonymous
    November 05, 2009
    The ability exists for Silverlight to make a call to a WCF service which can then talk to MSMQ to forward the one way message. This means that the WCF call can be over the HTTP ports which are normally already open. I understand that the MSMQ client can also send HTTP messages but this requires that the MSMQ client is installed.If you use the Silverlight and WCF method then all you need at the client end is the Silverlight plugin. This forum post on Silverlight.Net has more information. http://forums.silverlight.net/forums/t/126080.aspx Thanks, Finbar

  • Anonymous
    November 07, 2009
    Hi Simon, I received some feedback from my colleagues in Silverlight which I thought I'd share: "Silverlight is a lightweight, cross-platform, cross-browser runtime. I would be interested to hear what scenarios you have that would need to use that rather involved queue system for a client-side web app. Alternatives would be to use isolated storage (best bet), or if you must maintain state among many clients, a web service such as Amazon’s SQS. You could also host the app on a Windows server with ASP.NET and use MSMQ on the server, communicating via web requests or services." Do you have any scenarios you can share which highlight the need for messaging within the web application? Cheers John Breakwell (MSFT)