6.3 Creating an in-process connection custom adaptor

This section explains how to create an in-process connection custom adaptor.

To implement an in-process connection custom adaptor, you need to create a class containing an instance of the StreamInprocessUP interface.

An in-process connection custom adaptor receives an SDPConnector type object generated by the SDP server as a parameter of the execute method in the implemented StreamInprocessUP interface class. For the execute method, define a process that is equivalent to the main method of the custom adaptor.

Both the StreamInput interface and the StreamOutput interface are used for sending and receiving stream data. Both a StreamInput type object and a StreamOutput type object are generated by the method of the SDPConnector type object passed as the parameter of the execute method.

An overview of the interfaces used for sending and receiving stream data is provided below.

For sending stream data
For sending stream data, the StreamInput interface is used.
A custom adaptor uses an SDPConnector type object acquired from the connect method in the SDPConnectorFactory class to generate a StreamInput type object. The generated StreamInput type object uses the put method to send data.
For receiving stream data
For receiving stream data, the StreamOutput interface is used.
A custom adaptor uses an SDPConnector type object acquired from the connect method in the SDPConnectorFactory class to generate a StreamOutput type object. The generated StreamOutput type object uses one of the methods described below to acquire the stream data (tuples) from the query result on the SDP server.
  • Polling method
    A method that gives a high priority to reducing latency and which dynamically acquires tuples from the SDP server. The get or getAll method is used to receive tuples.
  • Callback method
    A method in which the actual method for acquiring tuples is initiated by the SDP server when tuples are generated on the SDP server. In this case, the actual method to be called by the SDP server must be predefined. Although the callback method increases latency compared to the polling method, CPU efficiency is higher since it is executed only when results are generated.

To use an in-process connection custom adaptor, you need to define the following in user_app.in-process-connection-application-name.properties.

user_app.classname=custom-adaptor-main-class-name
user_app.classpath_dir=custom-adaptor-main-class-path-name

For details about how to specify user_app.in-process-connection-application-name.properties, see the manual uCosminexus Stream Data Platform - Application Framework Setup and Operation Guide.

Organization of this section
6.3.1 Sending stream data (in-process connection custom adaptor)
6.3.2 Receiving query result data (in-process connection custom adaptor)
6.3.3 Notes