WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:Distributed Golden Thread Server
Description:Golden Thread Endpoint which distributes threads to and from clients via NKP
Id:DistributedGoldenThreadServer
Category:accessor prototype

Distributed Golden Thread Server is an accessor that must be instantiated from a prototype. You must instantiate the prototype in your module to create an accessor that can receive requests.

Parameters

The DistributedGoldenThreadServer prototype has the following initialisation parameters:

NameRulesTypingDefaultDescription
configMandatoryIdentifier or XML(none)
Configuration resource
nkpConfigMandatoryIdentifier or XML(none)
Configuration resource for internal NKP client
privateOptionalBooleanfalse
If included this parameter will mark the endpoint as private and it will not be exposed outside module.

Here is an auto-generated example of how to instantiate an instance of Distributed Golden Thread Server:

<accessor>
  <prototype>DistributedGoldenThreadServer</prototype>
  <config>Configuration resource</config>
  <nkpConfig>Configuration resource for internal NKP client</nkpConfig>
</accessor>
Import Requirements

To use Distributed Golden Thread Server accessor prototype you must import the module urn:com:ten60:netkernel:nkp2:dgt:

<import>
  <uri>urn:com:ten60:netkernel:nkp2:dgt</uri>
</import>

Generated endpoints

The DGT client creates the following logical endpoints in order to interact with it:

  • active:attachDGT which accepts 1 or more by-reference id arguments.
  • active:cutDGT which accepts 1 or more by-reference id arguments.
  • active:addDGTCutListener with 1 id argument which is a pass-by-value regular expression and a request argument which can be either a declarative request or INKFRequest.
  • active:removeDGTCutListener with 1 id argument which is a pass-by-value regular expression and a request argument which can be either a declarative request or INKFRequest.

Cut Listeners

Distributed Golden Threads support cut listeners. Cut listeners are callback requests that are issued when golden threads the match a particular identifier pattern are cut. Cut requests are issued after all clients have had their golden threads cut.

A typical pattern is to have a listener endpoint which adds a cut listener onPostCommission() and removes that same listener onPreDecommission().

Example

public class DGTListener extends StandardAccessorImpl {
    private IHDSDocument mListenerRequest;
    
    public void postCommission(INKFRequestContext aContext) throws Exception {
        IHDSMutator m= HDSFactory.newDocument();
        m.pushNode("request")
                .addNode("identifier","active:myCutListener")
                .pushNode("argument","arg:id").addNode("@name","id");
        mListenerRequest=m.toDocument(false);
        
        INKFRequest req=aContext.createRequest("active:addDGTCutListener");
        req.addArgumentByValue("id",".*");
        req.addArgumentByValue("request",mListenerRequest);
        aContext.issueRequest(req);
    }

    public void preDecommission(INKFRequestContext aContext) throws Exception {
        INKFRequest req=aContext.createRequest("active:removeDGTCutListener");
        req.addArgumentByValue("id",".*");
        req.addArgumentByValue("request",mListenerRequest);
        aContext.issueRequest(req);
    }

    public void onSource(INKFRequestContext aContext) throws Exception {
        String id=aContext.getThisRequest().getArgumentValue("id");
        System.out.println("Golden Thread "+id+" has been cut");
    }
}