NodeJS and Windows Azure: Using Service Bus Queues

I have been doing a lot of work with NodeJS and Windows Azure lately. I am planning to write a series of blog post about the techniques required build NodeJS applications that leverage different Windows Azure components. I am also planning on deep diving into the different elements of the NodeJS modules to integrate with Windows Azure.

Let’s begin with a simple tutorial of how to implement NodeJS applications that leverage one of the most popular components of the Windows Azure Service Bus: Queues. When using the NodeJS module for Windows Azure, developers can perform different operations on Azure Service Bus queues. The following sections will provide an overview of some of those operations.

Getting Started

The initial step to use Azure Service Bus queues from a NodeJS application is to instantiate the ServiceBusService object as illustrated in the following code:

   1: process.env.AZURE_SERVICEBUS_NAMESPACE= "MY NAMESPACE...";
   2: process.env.AZURE_SERVICEBUS_ACCESS_KEY= "MY ACCESS KEY....;
   3: var sb= require('azure');
   4: var serviceBusService = sb.createServiceBusService();

Creating a Queue

Create a service bus queue using NodeJS is accomplished by invoking a createQueueIfNotExists operation of the ServiceBusService object. The operation can take similar several parameters to customize the settings of the queue. The following code illustrates this process.

   1: function createQueueTest(queuename)
   2: {
   3:      serviceBusService.createQueueIfNotExists(queuename,  function(error){
   4:         if(!error){
   5:           console.log('queue created...');
   6:           
   7:         }
   8:       })
   9: }

Sending a Message

Placing a message in a service bus queue from NodeJS can be accomplished using the sendQueueMessage operation of the ServiceBusService object. In addition to the message payload, we can include additional properties that describe metadata associated with the message. The following NodeJS code illustrates the process of enqueueing a message in an Azure Service Bus queue using NodeJS.

   1: function sendMessageTest(queue)
   2: {
   3:  var message = {
   4:     body: 'Test message',
   5:     customProperties: {
   6:         testproperty: 'TestValue'
   7:     }}
   8:  
   9:     serviceBusService.sendQueueMessage(queue, message, function(error){
  10:     if(!error){
  11:         console.log('Message sent....');
  12:     }})   
  13: }

Receiving a Message

Similarly, to the process of enqueuing a message, we can dequeue a message from a service bus queue by invoking the ReceiveMessage operation from the ServiceBusService object. By default, messages are deleted from the queue as they are read; however, you can read (peek) and lock the message without deleting it from the queue by setting the optional parameter isPeekLock to true. The following NodeJS code illustrates this technique.

   1: function receiveMessageTest(queue)
   2: {
   3:   serviceBusService.receiveQueueMessage(queue, function(error, receivedMessage){
   4:     if(!error){
   5:         console.log(receivedMessage);
   6:     }
   7: })
   8: }

Putting it all together

The following code offers a very simple way to test the different operations we explored in this blog post using simple URL patterns such as http://<server>/SEND, http://<server>/RECEIVE and http://<server>/CREATE. Now go have some fun testing Windows Azure Service Bus Queues from NodeJS.

   1: function azureQueueTest(request, response)
   2: {
   3:  
   4:   var test= url.parse(request.url).path;
   5:  
   6: console.log(test);
   7:  
   8:     var queuename= 'myqueue';
   9:   
  10:  
  11:   if(test='CREATE')
  12:   {
  13:     createQueueTest(queuename);
  14:     console.log("queue created...");
  15:  
  16:   }
  17:  
  18:   if(test= 'SEND') 
  19:   {
  20:  
  21:     sendMessageTest(queuename);
  22:     console.log('enqueing message...');
  23:   } 
  24:  
  25:   if(test= 'RECEIVE')
  26:   {
  27:     receiveMessageTest(queuename);
  28:   }
  29:     
  30:     response.end();
  31: }
  32:  
  33: function createQueueTest(queuename)
  34: {
  35:      serviceBusService.createQueueIfNotExists(queuename,  function(error){
  36:         if(!error){
  37:           console.log('queue created...');
  38:           
  39:         }
  40:       })
  41:  
  42: }
  43:  
  44:  
  45: function sendMessageTest(queue)
  46: {
  47:  var message = {
  48:     body: 'Test message',
  49:     customProperties: {
  50:         testproperty: 'TestValue'
  51:     }}
  52:  
  53:     serviceBusService.sendQueueMessage(queue, message, function(error){
  54:     if(!error){
  55:         console.log('Message sent....');
  56:     }})   
  57: }
  58:  
  59: function receiveMessageTest(queue)
  60: {
  61:   serviceBusService.receiveQueueMessage(queue, function(error, receivedMessage){
  62:     if(!error){
  63:         console.log(receivedMessage);
  64:     }
  65: });
  66: }
  67:  
  68: process.env.AZURE_SERVICEBUS_NAMESPACE= "MY NAMESPACE...";
  69: process.env.AZURE_SERVICEBUS_ACCESS_KEY= "MY ACCESS KEY...";
  70:  
  71: //var test= "RECEIVE";
  72: var url = require('url');
  73: var sb= require('azure');
  74: var serviceBusService = sb.createServiceBusService();
  75:  
  76: var http= require('http');
  77: var server= http.createServer(azureQueueTest);
  78: console.log('service listening at localhost:1111...');
  79: server.listen(1111);

Tellago Technology Days: Enterprise Mobile Backend as a Service

Last week, as part of Tellago's Technology Update, I delivered a presentation  about the modern enterprise mobility powered by cloud-based, mobile backend as a service models. During the presentation we covered some of the most common enterprise mBaaS patterns that can be implemented using current technologies.

Below you can find the slide deck I used during the presentation. Feel free to take a look and send me some feedbck.

Mobilizing Your Line of Business Systems : Introducing The Enterprise Mobile Backend As A Service

After a brief hiatus, I am super happy to announce our next Tellago Technology Update. This time we will be focusing on one of my favorite topics: enterprise mobility. Here is a quick summary:

Title: Mobilizing Your Line of Business Systems : Introducing The Enterprise Mobile Backend As A Service


Enterprise mobility is, undoubtedly, one of the key trends in the modern enterprise. However, the traditional approach to enterprise mobility represents a fairly expensive proposition both technically and financially for most organizations. To keep up with the fast evolution of enterprise mobile trends, the industry desperately needs alternative technical and commercial models that can make enterprise mobility mainstream. The answer might be on another hot software trend: Backend as a Service.

This session introduces the concept of an Enterprise Mobile Platform as a Service (EntMBaaS). The session explores the different EntMPaaS capabilities and how they enable the integration of enterprise mobile applications with line of business systems.  We will use real world examples that illustrate how the EntMBaaS model facilitates the implementation and enablement of enterprise mobile applications and will compare the differences with traditional enterprise mobility approaches

Please register at https://www3.gotomeeting.com/register/429194358 we hope to see you there! 

Upcoming Speaking Engagements

This summer, I took a brief break from speaking engagements to focus on shipping our new software in Tellago Studios and not stress my already hectic travel schedule. However, I’ve accepted a few invites to speak at different conferences during the fall and winter. Here is a brief list of the ones that are already confirmed:

Software Architect Conference (London) http://www.software-architect.co.uk

  • NodeJS for the .Net Developer
  • I am a .NET developer but I have an iPhone and an Android

Oredev (Malmö, Sweden): http://oredev.org/

  • Kinect for Windows Deep Dive

Cloud Computing Expo (Santa Clara, CA) http://cloudcomputingexpo.com/

  • Introducing the Enterprise Mobile Platform as a Service

Cloud & Virtualization Live (Orlando, FL): http://virtlive360.com/Events/2012/Home.aspx

  • Using Windows Azure to Build the Next Generation of Mobile Applications
  • Windows Azure in the Real World: From Idea to Production in a Few Months

I plan to add a few more events to the list in the next few weeks. If you are attending any of these conferences feel free to contact me via this blog so that we can sync up.

Posted by gsusx | with no comments

What’s Up NYC? Speaking At The Cloud Computing Expo Next Week

Next week I will be speaking at the Cloud Computing Expo in New York City. I am particularly excited about this event because I will have the unique opportunity to present about the new concept behind our upcoming enterprise mobility platform: the enterprise mobile platform as a service. Read More via jrodthoughts....

Kinect for Windows SDK 1.5 is here

I know I am late to the announcement party but, in case you haven’t heard, Microsoft releated the Kinect for Windows SDK 1.5. This release is the second iteration of the product in only a few months which speaks volumes of the agile approach followed by the Kinect for Windows product team. The SDK contains many cool new features, here are the one I am most excited about:

·         Face Tracking SDK:  This component provides a real-time 3D mesh of facial features—tracking the head position, location of eyebrows, shape of the mouth, etc.

·         Kinect Studio,This tool which allows developers to record and play back Kinect data, dramatically shortening and simplifying the development lifecycle of a Kinect application. Now a developer writing a Kinect for Windows application can record clips of users in the application’s target environment and then replay those clips at a later time for testing and further development.

·         Near Mode Skeletal Tracking: This allows developers to create applications that track skeletal movement at closer proximity, like when the end user is sitting at a desk or needs to stand close to an interactive display.

·         Joint Orientation: Kinect for Windows runtime provides Joint Orientation information for the skeletons tracked by the Skeletal Tracking pipeline.  The Joint Orientation is provided in two forms:  A Hierarchical Rotation based on a bone relationship defined on the Skeletal Tracking joint structure, and an Absolute Orientation in Kinect camera coordinates.

In addition to the aformentioned components, this SDK includes a lot of performance improvements in the depth and color frame stream processing. If you are interested on Kinect for Windows applications, you should definitely go check out this release.

Now I know what  I am going to be doing this weekend.

Posted by gsusx | with no comments

Enterprise Mobility Best Practices With Chris Love

Enterprise mobility is one of the hottest trends in today’s IT industry. However, like any other emerging technology space, the industry is still trying to learn about the challenges and establish best practices and patterns that can help organizations to efficiently leverage the connected devices revolution. Selecting the right technology stacks or frameworks, making appropriate choice between native, hybrid or mobile-web applications to the techniques, integrating mobile applications to backend systems in your datacenter or correctly testing and manage mobile application are just some of the challenges faced on the journey to the mobile enterprise

This Thursday, Tellago’s enterprise mobility practice lead Chris Love will be hosting a webinar to discuss some of the patterns, best practices and technologies that can help organizations to efficiently build enterprise mobile applications. Chris is a well-known thought leader in the enterprise mobility space and one of the most knowable and pragmatic architects you will ever meet ;)

Chris will be showing some practical solutions to some the most important challenges in mobile enterprise solutions. If we have time, Chris might even give you a sneak pick of a new and super exciting enterprise mobility platform we have been working on.

If you are interested in enterprise mobility you must attend this webinar, Chris promises to keep things interesting.

Chatting About Big Data With ZDNet

A few weeks ago I had the pleasure of spending some time on the phone with Blue Badge Insight’s CEO Andrew Brust. From the ones of you who don’t know Andrew, he is an internationally recognized expert in subjects related to business intelligence and a well-known speaker and author. In addition to his work at Blue Badge, Andrew recently started contributing to ZDnet on which has become one of my favorite blogs about big data.

Andrew and I spent over 1 hour chatting about big data technologies, the market, new trends and the impact that big data technologies will have in the enterprise. Andrew summarized some parts of our conversation in his ZDNet blog http://www.zdnet.com/blog/big-data/big-data-the-billable-project-angle/387?tag=mantle_skin;content.

If you are interested on big data subjects I encourage you to read this interview and follow Andrew’s blog.

 Don’t forget to send me some feedback J

Posted by gsusx | with no comments

My Kinect for Windows Session at Techdays NL

I have been so crazily busy lately that I forgot to mention that a video of my Kinect for Windows session at Microsoft Techdays in The Netherlands is now available on channel9. The session covers the fundamental elements of Kinect for Windows as well as development best practices and techniques of Natural User Interface applications.

You can find the video below. Please check it out and send me some feedback.

 

Posted by gsusx | with no comments
Filed under: , ,

Tellago's Technology Update: Enterprise Mobility That Doesn't Suck

It’s time to rock the enterprise mobility world. Next week we will be hosting a webinar to talk about a new, modern, fresh and super cool approach to enterprise mobility.

Tellago’s enterprise mobility lead Chris Love will showcasing (that’s right not just talking about it) some of the components of Tellago’s enterprise mobility accelerator that address some of the biggest challenges on enterprise mobility such as AD authentication, authorization, messaging, application management and many others without THE NEED OF ANY ON-PREMISE INFRASTRUCTURE!

Yes, Tellago’s enterprise mobility accelerator is a cloud based solution that provides the necessary backed capabilities to make your mobile application enterprise ready. The highlight of the webinar will be the demo of our mobile enterprise application store!

Please register for this webinar at https://www3.gotomeeting.com/register/986332118

More Posts « Previous page - Next page »