Universal Messaging 9.8 | Universal Messaging Developer Guide | Enterprise APIs | Enterprise Developer's Guide for C++ | Publish / Subscribe using Datastreams and Datagroups | DataStreamListener
 
DataStreamListener
If a nSession is created with a nDataStreamListener then it will receive asynchronous callbacks via the onMessage implementation of the nDataStreamListener interface. The nDataStreamListener will receive events when:
*An event is published directly to this particular nDataStream
*An event is published to any nDataGroup which contains this nDataStream
*An event is published to an nDataGroup which contains a nested nDataGroup containing this nDataStream
*An example of how to create a session with an nDataStreamListener interface is shown below:

public class DataGroupClient : public nDataStreamListener{

nSession* mySession;

public DataGroupClient( std::string& realmURLs){
nSessionAttributes* nsa = new nSessionAttributes(realmURLs);
mySession = nSessionFactory::create(nsa, this);
mySession->init(this);
}

////
// nDataStreamListener Implementation
////

//Callback received when event is available
public void onMessage(nConsumeEvent* event){

//some code to process the message

}
}

Copyright © 2013-2015 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.