12/22/2014

Service Broker Exchanging Messages Between Two Servers

On our plane ride back from Germany, 10+ hours, I played a game of electronic chess.  And I lost.  So I watched a movie or two.  Later in the flight I played again.  Figured nothing to lose, except losing of course.  I exchanged a few pieces, then lost my queen, figured the game was over.  But I hung in there, soon got their queen, and some more pieces, then exchanged my 2 paws for 2 queens, and I had the machine at check mate.

So on my latest project, the goal was to take a previous developers code and get it working.  And I got it working, even created some automated scripts.  Except the goal was to get Service Broker talking from one database to another on different database servers.

So I requested a few VM to be built, sure enough, got them pretty quick.  Except the same code didn't work across servers.  So I scoured the internet, reading error messages, looking at sample code.  So many settings.  User permissions.  Endpoints.  Routes.  Services.  Queues.  Certificates.  I spent 11 hours on it today.

And sure enough, at the eleventh hour, I found an error message about network issues, so I enabled the SQL Browser, modified a few settings and sure enough, the two database servers were exchanging messages back and forth, using certificates for security.  Check mate.

Quite a battle.  I almost gave up a few times.  So tomorrow I'll get the servers to talk in the other direction.  And then add in a 3rd server for a 6 way communication frenzy.

That was a tough one~!

Here's the code... http://www.bloomconsultingbi.com/2014/12/service-broker-code-example-end-to-end.html