Questions on REST with MSMQ

Question:

I am looking for a solution for this situation - we have server, which hosts ASP.NET application with WCF REST API. We also have applications that post data to REST service. However, sometimes these applications are not online but data still needs to be transferred.
How could we use MSMQ binding when applications are offline? How to switch to MSMQ bindings when application is offline?
Both server and client applications use Windows Server 2003, IIS 6.0, .NET 3.5

Answers:

For your scenario, you want to use REST model for the main communication between client asp.net app and backend WCF service, but also use MSMQ when the service application is not available(for persist the requests), correct?
I think you can consider the following approaches:
1) The first idea is exposing two services(different endpoint) on the server. One is the original REST service which may not be available. And another service is using WCF msmq binding which(and turn on reliable and durable message features to ensure message reliabitliy). Thus, your client-side will need to determine the service availablility, if the REST service not available, turn to the MSMQ binding WCF service.  For using msmq binding in WCF, here are some resources.
#Queuing in WCF
http://msdn.microsoft.com/en-us/library/ms789048.aspx

#How Your WCF Service Can Use MSMQ as a Durable Message Store
http://www.devx.com/dotnet/Article/41482

#Sample Starter Project Using WCF and MSMQ
http://www.codeproject.com/KB/WCF/WCF_MSMQ_Integration.aspx
2) The second approach is directly using raw MSMQ programming(via System.Messaging namespace API), which send raw MSMQ message(when your wcf REST service not available), and your WCF service may also need to have a background task thread to monitor the MSMQ queue(which may contains message received during the offline time of the REST service).
For raw MSMQ programming in .NET, here are some useful articles:
#Programming MSMQ in .NET - Part 1
http://www.codeproject.com/KB/dotnet/mgrmsmq.aspx

#Leveraging MSMQ in ASP.NET Applications
http://www.15seconds.com/issue/031202.htm


Please remember to mark the replies as answers if they help and unmark them if they provide no help. Posted in: problems and solutions | Tags: questions answers q&a questions and answers msmq rest wcf reliability wcf service binding library message queue

ASP.NET AJAX 4.0 Preview 5

ASP.NET AJAX is a pure client-side JavaScript library that enables you to build Ajax applications that work with all modern web browsers. By taking advantage of ASP.NET AJAX client controls and templates, you can build database-driven web applications that execute entirely in the browser.
ASP.NET AJAX supports the following features:

  • Client templates that can be used to format database data in the browser
  • Client controls such as the DataView control
  • Client DataContext component that supports change tracking and identity management
  • ADO.NET Data Services support
  • WCF and ASMX Web service support
  • JSONP support
  • Observable pattern for plain JavaScript objects
  • Live Bindings
  • Command Bubbling
  • Support for managing complex links and associations between entities from multiple entity sets or tables

In Preview 5 of ASP.NET AJAX 4.0 we continue to improve the client-side data story introduced in previous previews of ASP.NET AJAX. In this release, we add support for the following features:
  • Dynamic and recursive templates
  • Binding Converters
  • Compatibility with the ASP.NET UpdatePanel

download: http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=32770

Posted in: asp.net | Tags: wcf asp.net ajax dataview datacontext json ajax 4.0 ajax 4.0 preview preview 5 asmx updatepanel