Click or drag to resize

TDengine.Subscribe Method

This function is used for start subscription service.

Namespace:  TDengineDriver
Assembly:  TDengineDriver (in TDengineDriver.dll) Version: 1.0.6
Syntax
C#
public static IntPtr Subscribe(
	IntPtr taos,
	bool restart,
	string topic,
	string sql,
	SubscribeCallback fq,
	IntPtr param,
	int interval
)

Parameters

taos
Type: System.IntPtr
taos connection return by Connect(String, String, String, String, Int16)
restart
Type: System.Boolean
If the subscription is already exists, to decide whether to start over or continue with previous subscription.
topic
Type: System.String
The name of the subscription.(This is the unique identification of the subscription).
sql
Type: System.String
The subscribe statement(select only).Only query original data and in positive time sequence.
fq
Type: TDengineDriver.SubscribeCallback
The callback function SubscribeCallbackwhen the query result is received.
param
Type: System.IntPtr
Additional parameter when calling callback function. System API will pass it to callback function without any operations.It is only used when calling asynchronously, and this parameter should be passed to NULL when calling synchronously
interval
Type: System.Int32
Polling period in milliseconds. During asynchronous call, the callback function will be called periodically according to this parameter; In order to avoid affecting system performance, it is not recommended to set this parameter too small; When calling synchronously, if the interval between two calls to taos_consume is less than this period, the API will block until the interval exceeds this period.

Return Value

Type: IntPtr
Return null for failure, return subscribe object for success.
Exceptions
ExceptionCondition
Exception
See Also