diff --git a/.gitignore b/.gitignore index 7dccd97..cda067a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,7 @@ logs results node_modules -npm-debug.log \ No newline at end of file +npm-debug.log + +config.json + diff --git a/Demo.md b/Demo.md new file mode 100644 index 0000000..e69de29 diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..f542942 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,6 @@ +Copyright 2012 Microsoft + +The **Demo-SBMessageReader-Nodejs** is licensed under the terms of the Apache License, Version 2.0. +You may use it according to the license as is most appropriate for your project on a case-by-case basis. + +The terms of this license can be found in http://www.apache.org/licenses/LICENSE-2.0 \ No newline at end of file diff --git a/README.md b/README.md index 6d6f6a7..1ccc813 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,35 @@ -Demo-SBMessageReader-Nodejs -=========================== +# Demo - Service Bus Message Reader (Node.js) # -Node.js Application which reads messages from a Service Bus Queue \ No newline at end of file +## Tutorial ## + +### Introduction ### + +Tutorials are sets of step-by-step guides that are designed to help you learn how to use key Windows Azure services and features. Each tutorial provides instructions to guide you through the process of developing a complete application. + +In this tutorial, you will explore the basic elements of a Windows Azure service by creating a simple GuestBook application that demonstrates many features of Windows Azure, including web and worker roles, blob storage, table storage, and queues. + +> **Note:** You can download the latest build of the Windows Azure Training Kit which includes a tested version of this HOL from here: http://bit.ly/WindowsAzureTK. + +### Repository Structure ### + +In the **root** folder of this repository you will find the tutorial document, **TutorialScript.md**. Before beginning with the HOL exercises, make sure you have followed all the required steps indicated at the setup section of the HOL document. + +In the **Source** folder you will find the source code of each of the exercises, as well as the assets and setup scripts. Throughout the HOL you will be instructed to open and explore the different solutions from the source folder. It is typically comprised of the following subfolders: + +- **Assets:** This folder contains files that are used throughout the exercises. +- **_Exercise Name_:** Each exercise that requires a programming solution has its own code folder. + - **Begin:** The begin solution is the initial incomplete solution that you will finish by following the steps of the corresponding exercise. + - **End:** The end solution is the final result you will achieve at the end of an exercise. +- **Setup:** This folder contains the dependency files and the setup scripts necessary to initialize specific configurations of the tutorial, being its execution is required in the majority of the Tutorials. + +### Get Started ### + +In order to run the solutions of the exercises provided by this tutorial you will first need configure your environment and install any necessary prerequisites such as runtimes, components, or libraries. For your ease, you can download and run the dependency checker [here] (http://go.microsoft.com/fwlink/?LinkId=245702) to automatically check and install all the requirements. Each tutorial also includes setup instructions for getting started. + +### Contributing to the Repository ### + +If you find any issues or opportunities for improving this tutorial, fix them! Feel free to contribute to this project by [forking](http://help.github.com/fork-a-repo/) this repository and make changes to the content. Once you've made your changes, share them back with the community by sending a pull request. Please see [How to send pull requests](http://help.github.com/send-pull-requests/) for more information about contributing to Github projects. + +### Reporting Issues ### + +If you find any issues with this tutorial that you can't fix, feel free to report them in the [issues](https://github.com/WindowsAzure-TrainingKit/Tutorial-HelloWindowsAzure/issues) section of this repository. \ No newline at end of file diff --git a/code/src/app.js b/code/src/app.js new file mode 100644 index 0000000..575dc01 --- /dev/null +++ b/code/src/app.js @@ -0,0 +1,18 @@ +#!/usr/bin/env node + +var program = require('commander'); +var azure = require('azure'); +var config = require('./config'); + +program.version('0.0.1') + .parse(process.argv); + +var loop = setInterval(function() { + var serviceBus = azure.createServiceBusService(config.namespace, config.accessKey, config.issuer); + serviceBus.receiveQueueMessage(config.queue, function(error, serverMessage){ + if(!error){ + console.log(serverMessage.body); + } + }); + }, 10); + diff --git a/code/src/config.json b/code/src/config.json new file mode 100644 index 0000000..05d3f61 --- /dev/null +++ b/code/src/config.json @@ -0,0 +1,6 @@ +{ +"namespace": "[sb-namespace]", +"issuer": "[sb-issuer]", +"accessKey": "[sb-access-key]", +"queue": "[sb-queue-name]" +} \ No newline at end of file diff --git a/code/src/package.json b/code/src/package.json new file mode 100644 index 0000000..60045c4 --- /dev/null +++ b/code/src/package.json @@ -0,0 +1,8 @@ +{ + "name": "demo-sbreadmessages", + "version": "0.0.1", + "dependencies": { + "azure": ">= 0.6.0", + "commander": ">= 0.6.1" + } +} \ No newline at end of file