Show / Hide Table of Contents

Interface IBatchAgent

Interface for the Batch Agent Start, stop and monitor predefined batch tasks

Namespace: SuperOffice.CRM.Services
Assembly: SuperOffice.Services.dll
Syntax
[Agent("Batch Agent", "Interface for the Batch Agent. Start, stop and monitor predefined batch tasks")]
public interface IBatchAgent : IAgent
Examples
using SuperOffice;
using SuperOffice.CRM.Services;

using (SoSession mySession = SoSession.Authenticate("user", "pass"))
{
   using (BatchAgent agent = new BatchAgent())
   {
      // call methods on agent here...
   }
}

Methods

DeleteBatchTaskAsync(int, CancellationToken)

Delete a batch task from the database.

Declaration
Task DeleteBatchTaskAsync(int batchTaskId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int batchTaskId

The batchTask id to delete.

CancellationToken cancellationToken
Returns
Type Description
Task

DeleteBatchTasksAsync(int[], CancellationToken)

Delete batch tasks from the database.

Declaration
Task DeleteBatchTasksAsync(int[] batchTaskIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] batchTaskIds

Array of batchTask ids to delete.

CancellationToken cancellationToken
Returns
Type Description
Task

GetAllBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, CancellationToken)

Get an array of system and user BatchTaskInfo for the provided task name and state.

Declaration
Task<BatchTaskInfo[]> GetAllBatchTaskInfosByNameAndStateAsync(string taskName, BatchTaskState state, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string taskName

A task name, NULL or blank to get all tasks

BatchTaskState state

The BatchTaskState to get batch tasks for.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of user and system BatchTaskInfos.

GetAllBatchTaskInfosByNameAsync(string, CancellationToken)

Get an array of system and user BatchTaskInfo for the provided task name.

Declaration
Task<BatchTaskInfo[]> GetAllBatchTaskInfosByNameAsync(string taskName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string taskName

A task name, NULL or blank to get all tasks

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of user and system BatchTaskInfos.

GetBatchTaskInfoAsync(int, CancellationToken)

Get a single BatchTaskInfo based on Id.

Declaration
Task<BatchTaskInfo> GetBatchTaskInfoAsync(int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int id

Id of the BatchTaskInfo to get.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo>

Returns a BatchTaskInfo.

GetBatchTaskInfosByAssociatesAndStateAsync(int[], BatchTaskState, CancellationToken)

Get an array of BatchTaskInfo for the provided associate id's and batch task state.

Declaration
Task<BatchTaskInfo[]> GetBatchTaskInfosByAssociatesAndStateAsync(int[] associateIds, BatchTaskState state, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] associateIds

Array of associate id's. Empty array for all. 0 for system tasks, -1 for all users, or specific user ids.

BatchTaskState state

The BatchTaskState to get batch tasks for.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of BatchTaskInfo.

GetBatchTaskInfosByAssociatesAsync(int[], CancellationToken)

Get an array of BatchTaskInfo for the provided associate id's.

Declaration
Task<BatchTaskInfo[]> GetBatchTaskInfosByAssociatesAsync(int[] associateIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int[] associateIds

Array of associate id's. empty array = all tasks, 0 = system tasks, -1 = all user tasks.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of user's BatchTaskInfo.

GetBatchTaskInfosByNameAndAssociatesAsync(string, int[], CancellationToken)

Get an array of BatchTaskInfo for the provided associate id's and batch task definition name.

Declaration
Task<BatchTaskInfo[]> GetBatchTaskInfosByNameAndAssociatesAsync(string name, int[] associateIds, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Batchtask definition name. Blank for all tasks.

int[] associateIds

Array of associate id's. Empty array for all. 0 for system tasks, -1 for all users, or specific user ids.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of BatchTaskInfo.

GetBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, CancellationToken)

Gets an array of user BatchTaskInfo with state defined by a BatchTaskState and the batchtask definition name.

Declaration
Task<BatchTaskInfo[]> GetBatchTaskInfosByNameAndStateAsync(string name, BatchTaskState state, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string name

Batchtask definition name. Blank for all tasks.

BatchTaskState state

The BatchTaskState to get batch tasks for.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of user BatchTaskInfo. System tasks are excluded.

GetBatchTaskInfosByStateAsync(BatchTaskState, CancellationToken)

Gets an array of user BatchTaskInfo with state defined by a BatchTaskState.

Declaration
Task<BatchTaskInfo[]> GetBatchTaskInfosByStateAsync(BatchTaskState state, CancellationToken cancellationToken = default)
Parameters
Type Name Description
BatchTaskState state

The BatchTaskState to get batch tasks for.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of user BatchTaskInfo. System tasks are excluded.

GetSystemBatchTaskInfosByNameAndStateAsync(string, BatchTaskState, CancellationToken)

Get an array of system BatchTaskInfo for the provided task name and state.

Declaration
Task<BatchTaskInfo[]> GetSystemBatchTaskInfosByNameAndStateAsync(string taskName, BatchTaskState state, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string taskName

A task name, NULL or blank to get all tasks

BatchTaskState state

The BatchTaskState to get batch tasks for.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of system BatchTaskInfos.

GetSystemBatchTaskInfosByNameAsync(string, CancellationToken)

Get an array of system BatchTaskInfo for the provided task name.

Declaration
Task<BatchTaskInfo[]> GetSystemBatchTaskInfosByNameAsync(string taskName, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string taskName

A task name, NULL or blank to get all tasks

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo[]>

Returns an array of system BatchTaskInfos.

StartBatchJobAsync(BatchTaskInfo, CancellationToken)

Start a batch job based on BatchTaskInfo.

Declaration
Task<int> StartBatchJobAsync(BatchTaskInfo batchTaskInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
BatchTaskInfo batchTaskInfo

Use BatchTaskInfo to describe the new batch job.

CancellationToken cancellationToken
Returns
Type Description
Task<int>

Returns the id of the created batch job.

StopBatchJobAsync(int, CancellationToken)

Stop a batch job based on Id.

Declaration
Task<bool> StopBatchJobAsync(int id, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int id

Id of the batch job to stop.

CancellationToken cancellationToken
Returns
Type Description
Task<bool>

Returns true if the job was stopped successfully.

UpdateBatchTaskAsync(BatchTaskInfo, CancellationToken)

Update information about a BatchTask. Only the following properties can be updated: State, Description, Response and Request.

Declaration
Task<BatchTaskInfo> UpdateBatchTaskAsync(BatchTaskInfo batchTaskInfo, CancellationToken cancellationToken = default)
Parameters
Type Name Description
BatchTaskInfo batchTaskInfo

The updated information to save.

CancellationToken cancellationToken
Returns
Type Description
Task<BatchTaskInfo>

The updated BatchTaskInfo

© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top