Development comments edit

When presenting my Distributed Application Development with NServiceBus talk at the Twin Cities Code Camp 10, I was asked by an attendee why NServiceBus’s automated retry feature doesn’t have some sort of a delay or back-off algorithm.  Unfortunately I had never really thought about it, and I didn’t have a very good answer for him.

This week I have the good fortune to be attending Udi Dahan’s Advanced Distributed System Design course in New York, so I thought I would get the answer direct from the source.

Udi gave me several good reasons why this is intentionally left out of NServiceBus.  I’ll try to convey his answers and add my own thoughts as well.

Read more →

Development comments edit

In the past, integrating NServiceBus into a web application typically meant adding the fluent configuration block to the Global.asax file and then keeping a static reference to the IBus property, because ASP.NET has not been very friendly to dependency injection.

In ASP.NET MVC 3, Microsoft has changed that by adding some nice abstractions around dependency resolution.  With a little effort, this allows us to inject NServiceBus (and its dependency injection container) into the dependency resolution pipeline.

In this example, I will show how to add NServiceBus to an MVC 3 web application so that common NServiceBus types (IBus chief among them) are injected into your controller classes.

Note: Karl Nilsson has written a post extending this one, showing how to inject NServiceBus into an ASP.NET MVC4 Web API solution, which requires just a few minor adjustments.

Read more →

Development comments edit

I’m no big fan of Apple’s Push Notifications API, but the fact is that iOS applications are no passing fad.  As developers providing server-side resources to mobile applications, our job is to do so as efficiently as possible.

For .NET developers able to commit financial resources, third party solutions such as Urban Airship can be the answer.  For developers wishing to control their own destiny, the open-source apns-sharp provides Apple push notifications and feedback services in a C# library.

Considering the ridiculous complexity of the Apple Push Notification format, it would behoove any developer to use apns-sharp instead of trying to re-invent the wheel.  NServiceBus together with apns-sharp would offer the reliability and scalability needed to successfully send push notifications for a high-capacity enterprise system.

Unfortunately, until recently apns-sharp and NServiceBus didn’t work and play well together.  I contributed to the apns-sharp to address these shortcomings.  In this article, I will describe how to use these modifications to apns-sharp to send push notifications with NServiceBus.

Read more →

Development comments edit

Sometimes technology is more than just technology.  Sometimes it reaches out and grabs you, and you have a moment of bliss where you realize everything has changed, that this is going to change everything and make your life better.

LINQ was one of those technologies for me.  Not the query-like syntax, per se; I consider that to be just a fancy compiler trick.  But the set of extension methods for IEnumerable and the way they can reduce a complex looping structure to a line or two is amazing and game-changing.

Over the last year I have been embracing NServiceBusJonathan Oliver describes NServiceBus as the best thing to happen to distributed systems since Ethernet, and he’s right on the money.  My first major project using NServiceBus has now been in production for a few months, and since then I’ve been reflecting on the process.

Now I realize there was one moment – that perfect moment of bliss – when I realized NServiceBus had changed everything.

Read more →

Development comments edit

Switching from Subversion to Mercurial with Kiln was one of the best things we ever did, but it wasn’t without its pain points. The biggest problem is when you have websites that can’t be hosted by the integrated Visual Studio web server (Cassini) and require complex IIS configurations that can’t be version-controlled.

With a distributed version control system (DVCS) such as Mercurial, you’re supposed to clone branch repositories all over the place, but redoing the IIS configuration can be a major drag.

Luckily, IIS7 comes with Microsoft.Web.Administration.dll, a managed assembly that allows you to automate server administration tasks, something that was next to impossible in IIS6.

Read more →

Development comments edit

If you want to send push notifications to an iPhone application from a .NET platform, the Mac Keychain turns out to be a major buzzkill.  In order to get a .p12 file suitable for use with the apns-sharp push notifications library in the Keychain, you have to perform a complex, manual (read error-prone) procedure that gets really annoying, especially if you have many apps to provision for push notifications, as I do.

Wouldn’t it be great if you could do this in C#, on Windows, without a Mac or the Keychain?  Well, you can!

Read more →

Technology comments edit

Our DVR died of hard drive failure the other day. It was like losing a member of the family.

We installed new flooring in our living room which meant moving all the furniture out. Now, I was careful. I’m a computer guy; I know there’s a fragile hard drive in there. I unplugged it, as I was told, and waited far longer than the 10 seconds they say to wait until it’s safe. Then I still treated it with the care I would afford a newborn, gently placing it in a safe location until the flooring project was complete.

When we plugged it back in it told us that the hard drive had failed and that we were essentially screwed.

Read more →

Development comments edit

Things change, and this guidance is now a bit outdated. Improvements Microsoft has made to IIS, more varied methods of hosting .NET web applications, and the addition of additional NServiceBus transports have made things much more nuanced. It is possible, and in some circumstances, even advisable to publish events from within a web application, but it should still be considered very carefully before being implemented.

Read the updated NServiceBus guidance for publishing events from web applications now.

The rest of this article should be considered deprecated and is here for historical purposes only.

It may be the single most asked question on the NServiceBus Yahoo Group, and it usually goes something like this:

The NServiceBus Documentation/FAQ says not to publish messages from a web application. But…why?

All the documentation says on the topic amounts to “Don’t. Bus.Send() a message instead.” This is true and good practice, but developers are smart people that aren’t commonly happy with an answer that doesn’t include a why.

In this article I’ll go into some depth on the three main reasons why you’re better off using Bus.Send() when in the web world than Bus.Publish().

Read more →

Development comments edit

NServiceBus is made from the ground up for scalability and reliability, but to take advantage of these features, you need to deploy it in a Windows Failover Cluster. Unfortunately, information on how to do this effectively is, as yet, incomplete and scattered. This article will describe the process for deploying NServiceBus in a failover cluster.

Read more →

Development, Technology comments edit

I’ve been an Apple fanboy for years. I grew up programming in BASIC on an Apple IIGS. I love my iPhone to death. However, I am not a member of the Church of Jobs that believes Steve can do no wrong. Now I’m a software developer and I appreciate a good, clean, easy to use API, and Apple falls short.

But fear not Apple! You may already have two push notification command formats on the books, but keep reading and I’ll suggest a third that won’t leave developers frustrated and angry with you.

Read more →