node-orleans
A node.js client for Codename Orleans.
Installation
Install the module with npm:
$ npm install node-orleans
Ensure the following are in the same directory as your node.js application:
Orleans.dll
Microsoft.WindowsAzure.StorageClient.dll
Your grain interfaces.dll
ClientConfiguration.xml
Initialising the client
First you need to initialise the client:
var orleans = ;var client = ; client;
Calling a grain
The client has a call
function which allows you to send a message to a grain:
client
grainType
The name of your grain interface without the I (i.e. 'Grain1')grainId
The ID of a grain. This can be either aninteger
,string
(which will be parsed as a guid) or an array with an extended primary key[integer/string, string]
grainMethod
The name of the method you want to callarguments
An array of argumentscallback
A function which will be called back on completion of the request. For grains with no return value (i.e. they returnTask
) this should befunction(err)
, otherwise this should befunction(err, result)
So for a grain interface that looks like this:
namespace MyGrainInterfaces{ public interface IGrain1 : Orleans.IGrain { Task SetValues(string stringValue, int intValue, bool boolValue); Task<string> GetString(); }}
We would use the following code to call it from node:
// IGrain1.SetValuesclient; // IGrain1.GetStringclient;
Known Issues
- Grains with generics are not supported (i.e.
IGrain<T>
) - Only simple types are supported (i.e.
string
,int
,double
,bool
);
License
MIT