Interface IActivityService
The IActivityService interface describes a component capable of adding and watching activities in Episerver's Social Activity Streams system.
Namespace: EPiServer.Social.ActivityStreams.Core
Assembly: EPiServer.Social.ActivityStreams.Core.dll
Version: 1.5.4Syntax
public interface IActivityService
Methods
Add<TExtension>(Activity, TExtension)
Adds an activity with a payload of type TExtension to the Activity Streams system.
The activity will be queued so that the calling thread is not blocked on processing of the activity,
which may be lengthy.
Declaration
void Add<TExtension>(Activity activity, TExtension extension)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| Activity | activity | An activity instance encapsulating some social activity that occurred in an application. |
| TExtension | extension | The payload supplied as an extension to the activity |
Type Parameters
| Name | Description |
|---|---|
| TExtension | Type of the data supplied as an payload of the activity. |
Remarks
Note that this API is used to publish an activity to the Episerver Social Activity Streams system. Adding an activity is a non-blocking operation. Any activities published to the system by invoking this API are queued for processing, and control is immediately returned to the calling application. Any exceptions or errors encountered while processing an activity when it is dequeued at a later time are logged.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when any of the parameters passed in are null. |
| System.ArgumentException | Thrown when any of the parameters passed in are invalid. |
Watch<TExtension>(IActivityHandler<TExtension>)
Watches an activity of type TExtension. The Activity Streams system invokes the specified handler when an activity of type TExtension is received by the system.
Declaration
void Watch<TExtension>(IActivityHandler<TExtension> activityHandler)
where TExtension : class
Parameters
| Type | Name | Description |
|---|---|---|
| IActivityHandler<TExtension> | activityHandler | An IActivityHandler handler to invoke when an activity of type TExtension is received by the activity streams system. |
Type Parameters
| Name | Description |
|---|---|
| TExtension | The type of activity or payload to be watched. |