“Nirvana Data Groups” – Managing Subscriptions on Behalf of Clients in an SDP – Part 2

As Single Dealer Platform’s (SDP) have become more focused on delivering custom flows of data to their clients, the ability to support fluid subscriptions efficiently has become very important . At my-Channels the response to this has been the addition of a new delivery paradigm : “Nirvana Data Groups” which they released late last year.

Like the technology described in the previous article, Nirvana Data Groups enable the out of band server based management of subscriptions. These subscriptions can be spread across enterprise, web and mobile clients.

Data Groups remove the need for clients to subscribe to and then potentially resubscribe to streams as and when market conditions dictate or margin groups change etc. Some of the obvious benefits include:

  • The simplification of the conversation that takes place between client and server
  • The removal of the need for resource specific ACLs within the system
  • Lower overall application latencies

The workflow for Nirvana Data Groups is not too dissimilar to the previous article in that:

  1. Business server application (more recently built using CEP technology) that connects to Nirvana with appropriate credentials and monitors the systems default Data Group
  2. Client Application connects to Nirvana with appropriate credentials. Nirvana automatically adds client connection to the default Data Group
  3. Business server is notified of client connection, adds client to appropriate Data Groups based on entitlements
  4. Client Application begins consuming data

Client connections can be added and removed from any number of Data Groups dynamically by the Business server application without the need for the client to interact with the server. The Business server application can create Data Groups on the fly, permission them accordingly and define relationships between different Data Groups.

Point 1 above would do something like this:

	// Defines operations for management of groups and streams
    public interface IDataGroupManager
    {
        void Connect(string url, string username);
        nDataGroup CreateDataGroup(string group);
        bool DeleteDataGroup(string group);
        void AddStreamToGroup(nDataGroup group, nDataStream stream);
    }

   // Server / Group Manager code
    public class GroupManager : IDataGroupManager, nDataGroupListener, nDataStreamListener
    {
        private nSession Session;
        private nSessionAttributes Attributes;
        private nDataGroup DefaultGroup;
	private string myuser;

        public nDataGroup CreateDataGroup(string name)
	{
		return Session.createDataGroup(name);		
	}

	public void DeleteDataGroup(string name)
	{
		Session.deleteDataGroup(name);
	}

	public void AddStreamToGroup(nDataGroup group, nDataStream stream)
	{
		group.add(stream);
	}

	// Connecting the Data Group Manager
        public void Connect(string url, string username)
        {
	    myuser = username;
            // setup the GroupManager connection to the Nirvana Server
            Attributes = new nSessionAttributes(url);
            Session = nSessionFactory.create(Attributes, username);
            // Initialise with the Data Stream Listener
            Session.init(this);
            // Get the default Data Group and add a listener to get callbacks for connecting users to the default data group
            DefaultGroup = Session.getDefaultDataGroup(this);
        }

Point 2 would look a little like the following code:

public class Client : nDataStreamListener
{	
	        private nSession Session;
        	private nSessionAttributes Attributes;
		private string myuser;
		
		public void Connect(string url, string username) 
		{
			myuser = username;
        		// setup the GroupManager connection to the Nirvana Server
            		Attributes = new nSessionAttributes(url);
            		Session = nSessionFactory.create(Attributes, username);
            		// Initialise with the Data Stream Listener
            		Session.init(this);
		}
	}

Point 3,this is where we map incoming client connections to Data Groups. The code might look like this:

// Callback received when Users connect (initialise a Nirvana session with a Data Stream Listener
public void addedStream(nDataGroup group, nDataStream stream, int count)
{
		if (!stream.Subject.Contains(myuser)) 
		{
			// we have got a connection from another stream user
			// now we need to work out what groups to add this user to, 
			// for the purposes of this example, lets assume this is performed by some entitlements service
			string[] groups = IGroupEntitlements.getEntitledGroups(stream.Subject);
			foreach (string sgroup in groups) 
			{
				nDataGroup group = IDataGroupManager. CreateDataGroup(sgroup);
				IDataGroupManager. AddStreamToGroup(group, stream); 
			}
		}            
}

Point 4. This code demonstrates how data is consumed by the client connection

// Callback for consuming events
public void onMessage(nConsumeEvent evt) {
		// events consumed via the nDataStreamListener callback
} 

Advertisement

~ by mdavey on January 26, 2011.

2 Responses to ““Nirvana Data Groups” – Managing Subscriptions on Behalf of Clients in an SDP – Part 2”

  1. [...] This post was mentioned on Twitter by paulcbrant, Bala Subra. Bala Subra said: #Lab49 : “Nirvana Data Groups” – Managing Subscriptions on Behalf of Clients in an SDP – Part 2: As Single Deale… http://bit.ly/fSHdd4 [...]

  2. [...] feature called DataGroups, and feedback received to date has been very encouraging. Thank you to Matt Davey and Olivier DeHeurles, both of whom have written excellent blogs on their thoughts about [...]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 273 other followers