Service Bus Notification Hubs – Part 1

 

This past week the Service Bus team at Microsoft rolled out a preview of their latest offering called Service Bus Notification Hubs.  For those of those of you who keep an eye open for all things Middleware from Microsoft, you may recognize the code name of the project: Iguazu.  You may  have even seen Iguazu presented by Clemens Vasters at one of the recent Microsoft conferences/summits.

What are Service Bus Notification Hubs?

So what are Service Bus Notification Hubs?  Probably the simplest way to explain it is an internet-scale Push Notification Service.  Push Notifications are nothing new.  The major mobile platforms all have them and you have inevitably used them if you use social media apps like Facebook, Twitter or even games.  These notifications are often called “Toast Notifications” in the sense that they pop up and inform you of some relevant event such as someone commenting on a post of yours or informing you that you have been mentioned on Twitter.

If they have been around for a while, why do I care about them now?

Just because Notification Services from Apple, Google and Microsoft have been around for a long time, doesn’t mean that it has been easy to use them.  Often times developers need to manage all of the subscriptions and channels within their own data stores. Developers were also required to deal with the nuances of the  different platforms and managing which subscriptions were running on a particular platform.  This results in a lot of fragmentation.  Finally, dealing with large scale has also been challenging for some organizations.  Imagine if you were a large media outlet with hundreds of thousands or millions of users.  Providing timely notifications to users of this magnitude becomes extremely important.  For example receiving a notification for a touchdown that happened in the 2nd Quarter when the game is already over is not a good user experience. Service Bus Notification Hubs can take care of this by delivering to a wide audience immediately.

Benefits of using Service Bus Notification Hubs

While I am relatively new to this technical domain(mobile notifications), I found building solutions off of Service Bus Notification Hubs was pretty straight forward.  I find it very compelling that I can choose to use Native Notifications that are specific to a respective platform or I can just use one of the many generic templates that ship and can address devices on multiple platforms.  Since the service is currently in “preview mode”, only Windows 8 and IOS notifications are supported but Microsoft is targeting Android and Windows Phone when the service becomes Generally Available.  Another key benefit, and perhaps this is why it is in the Service Bus family, is the service is true Pub-Sub.  I don’t have to worry about specific subscriptions.  I just have to throw the message at the Service Bus and let it figure out who is interested in it.  It could be 1 person/device or it could be 100 000.  It doesn’t matter to my Server code.  This features alone makes the service worth it.

What’s next?

There is quite a bit of content that is already available for this topic and I recommend checking out the following links:

Also stay tuned to this blog where I will be walking through a corporate scenario from the Energy sector where I will combine Service Bus Notification Hubs, BizTalk and Windows 8 Store Apps.

BizTalk 2013 and ReST

BizTalk 2013 and ReST

I am presenting a session on BizTalk 2013 and Rest at BizTalk Saturday – BizTalk 2013 Hands on Days – Auckland on February 9th. I was all set to write a summary of this topic but this morning I woke and found that Steef-Jan Wiggers has just written a very good summary entitled  Microsoft offers […]
Blog Post by: mbrimble

Exclusive Pre-announcement: Oporto BizTalk Innovation Day (14th March 2013 – Oporto, Portugal)

Exclusive Pre-announcement: Oporto BizTalk Innovation Day (14th March 2013 – Oporto, Portugal)

I’m delighted to pre-announce that BizTalk innovation Event is coming to Portugal! The event is called “Oporto BizTalk Innovation Day” and will take place in Oporto, Portugal on Thursday 14 March, 2013. This is the first time in Portugal (also on Iberia) that we are conducting a full day event dedicated to Microsoft BizTalk Server. […]
Blog Post by: Sandro Pereira

BAM_AN packages not executing by SQL jobs

BAM_AN packages not executing by SQL jobs

I recently hit an issue with the BAM_AN packages executed through a SQL job failing with the following message. Object reference not set to an instance of an object. at…. UpdateDataSourceAndGetAnnotation(String cubeName, String asServerName, String asDatabaseName, String ssServername, String ssDatabaseName) The reason was the account under which my SQL jobs were running did not have […]
Blog Post by: DipeshA

BizTalk Message Archiving

Recently at the BizTalk Summit in London I was asked a question about Message Archiving from BizTalk and one of the most common solutions to this is the Message Archiving Pipeline Component which was written by my old friend Nick Heppleson.

After the summit I was pondering this archiving feature and wish that at the time I had mentioned Storsimple. Recently Id been speaking with Michael Royster from Microsoft in the UK and he had been telling me about the new acqusition Microsoft had made and how this solution combines on-premise storage with storage in Windows Azure which offers lots of opportunities.
The key thing here is that Storsimple is an appliance which you add to your data centre which offers up file storage but only certain data is kept on premise and the rest is kept in the cloud. The appliance handles the magic underneath that but your applications just see file shares on the network which they can communicate with.
Coming back to the archiving requirement if you have a customer who needs to archive a lot of messages and your worried about house keeping around this then you should certainly consider combining Message Archive Pipeline Component plus StorSimple to provide and excellent combined solution to this problem.
There is obviously a cost for StorSimple but you can reuse the applicance across other applications and use if for storage to help sharepoint and exchange implementations too or possibly back up archiving.
Anyway just a few thoughts that were lingering around my head on the train ride home last week. Heres some links if your interested:
http://www.storsimple.com/
http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=4000008345

Poor, confused C# compiler

The C# compiler is a pretty good thing, but it has limitations. One limitation that has given me a headache this evening is its inability to guard against cycles in structs. As I learn to think and programme in a more functional style, I find that I am beginning to rely more and more on structs to pass data. This is natural when programming in the functional style, but structs can be damned awkward blighters.

Here is a classic gotcha. The following code won’t compile, and in this case, the compiler does its job and tells you why with a nice CS0523 error:

struct Struct1
{
public Struct2 AStruct2 { get; set; }
}

struct Struct2
{
public Struct1 AStruct1 { get; set; }
}

Structs are value types and are automatically instantiated and initialized as stack objects. If this code were compiled and run, Struct1 would be initialised with a Struct2 which would be initialised with a Struct1 which would be initialised with a Struct2, etc., etc. We would blow the stack.

Well, actually, if the compiler didn’t capture this error, we wouldn’t get a stack overflow because at runtime the type loader would spot the problem and refuse to load the Struct1 type. I know this because the compiler does a really rather poor job of spotting cycles. For example, if you define generic members on your structs things can easily go awry. I have an example of this, but it would take a lot of explaining as to why I wrote the code the way I did (believe me, I had reason to), so instead I’ll provide a much simpler example. Here is a daft attempt to avoid the cycle using a nullable type:

struct Struct1
{
public Struct2? Struct2 { get; set; }
}

struct Struct2
{
public Struct1 Struct1 { get; set; }
}

Of course, this won’t work (duh – so why did I try?). System.Nullable<T> is, itself, a struct, so it does not solve the problem at all. We have simply wrapped one struct in another. However, the C# compiler can’t see the problem. The code will compile just fine. At run-time it will blow up in your face with a ‘Could not load type <T> from assembly’ (80131522) error. Very nasty.

By and large, I get on well with the C# compiler. However, this is one area where there is room for improvement.