Home > @i2analyze/i2connect > services > ILongRunningServiceConfig > longRunning
services.ILongRunningServiceConfig.longRunning property
Indicates whether the service involves a long-running operation.
Signature:
readonly longRunning?: boolean | {
pollingIntervalInSeconds?: number;
};
Returns: boolean | { pollingIntervalInSeconds?: number; }
Introduced: API version 2.0
Remarks
When the property contains a Boolean value, true
and false
have their usual meanings.
When the property contains an object, the service does involve a long-running operation, and the i2 Analyze server polls the service for progress information at the specified interval.
A service that involves a long-running operation can access the longRunningState
within the acquire callback for the service. For example, it can use services.ILongRunningState.isCanceled to determine whether the user has canceled the query. The service can also set substatuses to provide detailed feedback to the user about a long-running query.
Example
addService(
{
name: 'Sample',
longRunning: true,
},
({ longRunningState }) => {
longRunningState.addSubstatus('information', 'Query started');
if (longRunningState.isCanceled) {
// Stop processing the query.
}
...
}
);