.NET Compact Framework WCF and Store and Forward Messaging Webcast

You Can Take it With You

Syndication

News

  • Don't miss the next Windows Mobile Webcast... Unit Testing for Mobile Devices: http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032382824&EventCategory=4&culture=en-US&CountryCode=US.

Just a quick note to let everyone know that I'll be giving a Webcast this Wednesday (12-Dec) talking about Windows Communication Foundation as it's implemented on Windows Mobile with a focus on Store-and-Forward messaging. Store-and-Forward messaging is a .NET CF extension to WCF that significantly simplifies communication between mobile devices because it eliminates the need for the source and destination devices to be online at the same time. The sending device can send the message at anytime - if the receiving device is online, the device receives the message immediately; otherwise, the receiving device receives the message the next time the receiving device comes online.

Please join me on Wednesday for a look at the architecture of .NET CF WCF Store-and-Forward messaging and a demonstration of how to build applications that take advantage of it.

The Webcast will be broadcast live on Wednesday, 12-December at 11:00 AM PST, 2:00 PM EST, 1900 UTC. I hope to see you there.


Posted Dec 10 2007, 05:22 PM by jim-wilson

Comments

Henrik wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-10-2007 11:26 PM
Here is a link to the webcast:
http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032358593&EventCategory=4&culture=en-US&CountryCode=US
Jim Wilson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-11-2007 6:12 AM
Henrik;

Thanks for posting the link!!

Sorry for the oversight on my part. :-(

Thanks again,
Jim
Markus Anderson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-13-2007 6:48 AM
Jim:

Enjoyed your presentation yesterday on WCF for mobile - nicely done. A couple of weeks ago I could hardly wait to get VS2008 installed because I specifically wanted to try out the WCF capability in the IDE. Frankly, I was a bit disappointed when I discovered WCF had been "cut down" to just the two bindings and that great things like callbacks, sessions, transactions and the regular service framework had been removed ... not a surprise I guess considering resource issues on a mobile device.

Anyway, I thought your presentation was well done on the mail binding (we use MSMQ for our mobile apps for the same reasons the mail binding was created ... bi-directional, disconnected, asynchronous communications).

I think MSMQ is a better approach in that it doesn't require Exchange (not to mention the MSMQ components are already part of the OS so any Windows box could act as the relay), but I can see why Microsoft might prefer Exchange from a strategic perspective.

There were a couple of things you were going to follow up on after the presentation: 1) get back to us about if Exchange 2007 is required, or can it work with Exchange 2003 too? 2) you were going to post the sample code here in your blog.

Again, thanks for a great presentation. Looking forward to the sample code and your findings about supported versions.

Markus Anderson
markus@pervasivethinking.com
Jim Wilson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-13-2007 10:01 AM
Markus;

Thank you for your kind words and feedback.

I agree with you that MSMQ is probably a better solution technologically, the problem is that MSMQ just never reached the level of adoption that Exchange has. Ideally Microsoft will eventually offer both MSMQ and Mail bindings so that people can take advantage of the rich features of MSMQ if they have made that investment. I haven't investigated the effort involved but you may (with reasonable effort) be able to port the MSMQ binding from the desktop by getting the source code using Reflector or similar.

Like you, I'd like to see more features added to the NETCF implementation of WCF and I imagine that'll happen over time. Just think of how restricted NETCF 1.0 was ... NETCF 3.5 has come a long way since then.

I will post the follow up information from webcast shortly. We've had a weird dental day 'round here. I had to have an "emergency" (the Endontist's words) root canal which threw me way off schedule - and if that weren't enough ... my wife broke a tooth this morning.

Anywho ... I apologize for the delay on getting the info out there... I'm taking my wife to the dentist now but will follow up as soon as I return.

Thanks,
Jim
Markus Anderson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-13-2007 8:07 PM
Thanks for the great follow up info.

I too think and hope that over time Mobile WCF will "catch up" a bit with its desktop sibling. I have thought about extending their CustomBinding to create my own "mobile MSMQ" binding. My problem is I'm a bit short on time, and I'm not convinced this would be any better than my existing MSMQ code we already have proven out - I hate making moves that are not a step forward.

I'm not an expert in Exchange, but it seems to me if Microsoft selected Exchange because of its wider adoption they should have added support for earlier versions ... kind of ironic to only support 2007, but to offer it under the pretext of "because it's widely adopted."

Oh well, time to dig in to the sample code and check all ths out. Thanks for all your help Jim.

Markus Anderson
Markus Anderson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-14-2007 7:24 AM
Good morning:

I thought I would pass along some additional thoughts. I was thinking about all this last night and I think Exchange has a single BIG advantage over MSMQ ... changing IP's when changing networks.

With MSMQ (a true "push" model) the transmitter needs to know the IP of the receiver's endpoint in order to push the Message. With mobile applications (at least if you're out driving around town) you will be changing IP addresses as you go from the WiFi network at Starbucks, to the cellular network as you drive, to the ??? as you do whatever. My point is that the Server (transmitter in this example) will loose its ability to push a message until it gets updated IP information.

With the Mail binding and Exchange this issue goes away because Exchange doesn't care that your device is changing IPs. As the transmitter tries to send the Message to the receiving device Exchange will simply fire off one of its SMS Control Messages, thereby instructing the device to "call home" and pick up the pending Message ... I refer to this as the "ET" model (from the movie).

Although MSMQ has some serious power and benefits, this is the one big limitation I see, and the biggest reason to use Exchange instead. I guess the perfect solution would have the strenghts of both technologies rolled into a single SuperMobile Binding.

The question becomes is it better to extend MSMQ with benefits of Mail, or do you extend Mail with the benefits of Exchange???
Markus Anderson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-15-2007 10:31 AM
Good afternoon Jim:

I have another note to post about using the Mail binding - it works on Exchange 2003, sort of ... let me explain:

Using your code as the basis for a proof-of-concept I'm putting together, I am able to send test messages round trip from an actual AT&T Tilt (this is the new HTC TyTn II device ... WM v6.0 Pro, 2GB memory card, GPS, and 3G network speeds here in Miami FL) to my Exchange 2003 server, and back again to the device as long as I'm cradled.

If I'm not cradled then the WCF Messages show up in the Outbox on the device (BTW ... this is also true in the v2 emulator from VS2008). Once I choose to manually sync from the device the messages are forwarded onto my Exchange server, and sent back to my device using the AUTD feature.

Can you confirm with me that when running on Exchange 2007 WCF Messages are not trapped in the Outbox? Either waiting for the user to manually sync or waiting for some other event back at the server that would invoke the AUTD feature? I'm hopping they get sent off automatically instead from the device to the Exchange server.

Or, is it neccessary to send the WCF Message, and then to programatically invoke ActiveSync to clear the Outbox??

Please confirm.

Thanks,

Markus Anderson
Markus Anderson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-15-2007 10:37 AM
One last note about Exchange 2003 ... the WCF Messages show up in the Inbox as well as the Sent folder on the Outlook client (as they come in and get sent back out via AUTD).

I'm assuming this is not the case with Exchange 2007?

Markus
Jim Wilson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-19-2007 10:57 AM
Markus;

As you've indicated, the messages should be sent off automatically to the Exchange 2007 server. The key to that working though, is that the device hosting the application must be properly configured to sync directly with Exchange for AUTD mail.

Jim
Jim Wilson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-19-2007 11:04 AM
Markus;

Good point on MSMQ needing the IP Address which as you mentioned creates an addressing problem for locating the destination device.

Another issue regarding MSMQ occurred to me yesterday. The WCF MSMQ binding uses the binary encoder which is not supported (currently) on CF. So adding support for MSMQ would require the addition of another encoding class implementation.

So it seems, that when considering the mobile-device addressing issues and the required increase in memory footprint, not supporting WCF MSMQ on .NET CF seems like a pretty reasonable choice (at least for now) - would you agree?

Thank you for all of your feedback and insight. Please keep it coming.

Jim
Markus Anderson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-22-2007 2:01 PM
Actually, we use the Binary Encoder on our WinCE 5 mobile apps ... works well (MSMQ v3.0 from the optional server components code ... I can get the build numbers if you need it). Let me know if you need copies of the MSMQ files - happy to send them along because it took me a while to find the correct versions so that EVERYTHING would work correctly. But, we use Bianary encoders both on the Server as well as the mobile apps. This is as simple as either a registry change, or use the VisAdm tool to switch to Binary using a GUI on the device.

I've been playing around with all this and I added additional code to my MSMQEngine class (this encapsulates all my neccessary MSMQ logic on the device) ... I'm now listening for network events, and when my IP changes (as long as I have a valid IP and not something like 127.0.0.1) I fire off a "maintenance" message back to my Server indicating the updated IP Address. This allows the Server's MSMQ implementation to always PING the device and initiate a message transmission even though the device might be going through different addresses. I view this like my own "SMS Control Message" .... just in reverse.

Thanks Jim,

Markus
Jim Wilson wrote re: .NET Compact Framework WCF and Store and Forward Messaging Webcast
on 12-24-2007 11:02 AM
Markus;

Thanks for the info.

When I mentioned binary encoding, I should’ve been more specific. When I said that binary encoding isn’t supported, I was referring to WCF’s lack of support for binary encoding in .NET CF – my apologies for not being clear.

The maintenance message you use to inform the server of the changes to the device IP Address is a cool solution. I’m not that familiar with the details of how MSQM works so I’m curious how some of the more complex changing IP Address issues are handled. Here’s a couple of "scary" :-) ones that come to mind...

What happens in this scenario? A device is online with IP Address "A" and then goes offline for a bit. The server sends a message to the last known IP Address, "A", but when the device comes back online it’s on a different network and is therefore assigned a new IP Address, "B". It seems that the message sent to IP Address "A" may possibly end up waiting in the queue for quite some time.

To take this situation even further... what if a user takes their device (device "1") into an Internet-enabled café close to the office and the device reports back as having IP Address "A", the user leaves and device "1" goes offline. The server sends a message to IP Address "A" which is of course held in the queue because the destination is unavailable. Another user who works at the same company and is running the same application walks into the café and his device (device "2") is assigned IP Address "A" – wouldn’t device "2" end up receiving the message intended for device "1"?

What would be the effect on ordered messages? For example let’s assume that a sequence of 5 ordered messages must be sent to a device. The device is online with IP Address "A" and then goes offline. The server sends message "1" and message "2" to IP Address "A". The device then comes back online with IP Address "B"; you don’t want to send message "3" to IP Address "B" because the device hasn’t seen messages "1" and "2".

To avoid these situations it seems that you’d have to have a unique device ID included in the maintenance message that the device sends to the server to update the IP Address. The server would have to locally track the message contents and intended device id of each message sent to a particular IP. If that device comes up with a different IP Address, the server would then have to delete the messages that were initially sent to what is now the wrong IP Address and then resend the messages to the devices new IP. Similarly, if a device comes up on an IP Address that is associated with a different device id, the server would have to be sure to delete any pending messages in that queue before the device starts reading from the queue; otherwise, the messages will go to the wrong device.

As I mentioned, I don’t know much about the details of MSMQ’s workings so maybe I’m representing the problem as being more difficult than it really is. It does seem like these are situations that one would want to thoroughly test.

Whatt’a ya think? Are these real concerns or is my lack of understanding of how MSMQ works creating artificially complex problems? :-)

I look forward to hearing back from you. Have a fantastic holiday!!

-Jim

Add a Comment

(required)  
(optional)
(required)  
Remember Me?