Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andre Rodrigues committed Apr 21, 2012
2 parents 39f9604 + 3ad8eae commit e22f6ff
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 7 deletions.
62 changes: 57 additions & 5 deletions README.md
Expand Up @@ -21,6 +21,11 @@ Node.js Developer Center.
* Service Bus
* Queues: create, list and delete queues; create, list, and delete subscriptions; send, receive, unlock and delete messages
* Topics: create, list, and delete topics; create, list, and delete rules
* Service Runtime
* get configuration settings and access local resources
* get role instance information for current role and other role instances
* query and set the status of the current role


# Getting Started
## Download Source Code
Expand Down Expand Up @@ -162,9 +167,9 @@ queueService.getMessages(queueName, function(error, serverMessages){
});
```

## ServiceBus Queues
## Service Bus Queues

ServiceBus Queues are an alternative to Storage Queues that might be useful in scenarios where more advanced messaging features are needed (larger message sizes, message ordering, single-operaiton destructive reads, scheduled delivery) using push-style delivery (using long polling).
Service Bus Queues are an alternative to Storage Queues that might be useful in scenarios where more advanced messaging features are needed (larger message sizes, message ordering, single-operaiton destructive reads, scheduled delivery) using push-style delivery (using long polling).

The **createQueueIfNotExists** method can be used to ensure a queue exists:

Expand Down Expand Up @@ -199,9 +204,9 @@ serviceBusService.receiveQueueMessage('taskqueue', function(error, serverMessage
});
```

## ServiceBus Topics
## Service Bus Topics

ServiceBus topics are an abstraction on top of ServiceBus Queues that make pub/sub scenarios easy to implement.
Service Bus topics are an abstraction on top of Service Bus Queues that make pub/sub scenarios easy to implement.

The **createTopicIfNotExists** method can be used to create a server-side topic:

Expand Down Expand Up @@ -245,7 +250,54 @@ serviceBusService.createSubscription(topic, subscription, function(error1){
});
```

** For more examples please see the [Windows Azure Node.js Developer Center](http://www.windowsazure.com/en-us/develop/nodejs) **
## Service Runtime

The Service Runtime allows you to interact with the machine environment where the current role is running. Please note that these commands will only work if your code is running inside the Azure emulator or in the cloud.

The **getConfigurationSettings** method lets you obtain values from the role's .cscfg file.

```Javascript
azure.RoleEnvironment.getConfigurationSettings(function(error, settings) {
if (!error) {
// You can get the value of setting "setting1" via settings['setting1']
}
});
```

The **getLocalResources** method lets you obtain data from the role's local storage.

```Javascript
azure.RoleEnvironment.getLocalResources(function(error, resources) {
if(!error){
// You can get the path to the role's diagnostics store via
// resources['DiagnosticStore']['path']
}
});
```

The **getCurrentRoleInstance** method lets you obtain information about where the current instance is running, among other things:

```JavaScript
azure.RoleEnvironment.getCurrentRoleInstance(function(error, instance) {
if (!error && instance['endpoints']) {
// You can get information about "endpoint1" such as its address and port via
// instance['endpoints']['endpoint1']['address'] and instance['endpoints']['endpoint1']['port']
}
});
```

The **getRoles** method lets you obtain information about role instances running on other machines:

```Javascript
azure.RoleEnvironment.getRoles(function(error, roles) {
if(!error){
// You can get information about "instance1" of "role1" via roles['role1']['instance1']
}
});
```


**For more examples please see the [Windows Azure Node.js Developer Center](http://www.windowsazure.com/en-us/develop/nodejs)**

# Need Help?

Expand Down
5 changes: 5 additions & 0 deletions examples/helloruntime/HelloWorker/README.txt
@@ -0,0 +1,5 @@
This sample shows how to use the Azure ServiceRuntime API to discover endpoint address and port from the
current role instance setting, How to retrieve local storage resource information (particularly the
diagnostic store), and how to retrieve role configuration settings.

To use this sample, you must place a copy of node.exe (v0.6.11 or higher) in the HelloWorker directory.
2 changes: 1 addition & 1 deletion examples/helloruntime/HelloWorker/package.json
Expand Up @@ -3,7 +3,7 @@
, "version": "0.0.1"
, "private": true
, "dependencies": {
"azure": ">=0.5.4"
"azure": ">=0.5.3"
, "express": "2.5.8"
, "jade": ">= 0.0.1"
}
Expand Down
14 changes: 14 additions & 0 deletions examples/helloruntime/HelloWorker/setup_worker.cmd
@@ -0,0 +1,14 @@
@echo off

echo Granting permissions for Network Service to the deployment directory...
icacls . /grant "Users":(OI)(CI)F
if %ERRORLEVEL% neq 0 goto error
echo OK

echo SUCCESS
exit /b 0

:error

echo FAILED
exit /b -1
1 change: 1 addition & 0 deletions examples/helloruntime/deploymentSettings.json
@@ -0,0 +1 @@
{"Slot":"","Location":"","Subscription":"","StorageAccountName":""}
2 changes: 1 addition & 1 deletion examples/serviceexplorer/package.json
Expand Up @@ -2,7 +2,7 @@
"name": "serviceexplorer"
, "version": "0.0.1"
, "dependencies": {
"azure": ">= 0.5.1"
"azure": ">= 0.5.3"
, "express": "2.5.1"
, "ejs": ">= 0.0.1"
, "underscore": ">= 1.3.1"
Expand Down

0 comments on commit e22f6ff

Please sign in to comment.