Unable to get Integration Bus to process new activities

Tom Troughton asked on December 4, 2015 16:35

In Kentico 8.2 I'm trying to write an integration connector subscribed to the creation of activities.

I've create the connector (code below), registered it in Kentico and enabled integration bus in Settings. When I debug the application I see the Init method in my connector being hit so I know it's registered correctly. However, navigating the site I can see activities being created in the database, but my ProcessInternalTaskAsync method is never being hit. Anyone know why this might be?

UPDATE: If I amend this to subscribe to user object changes then it works. Does this mean it is not possible to subscribe to activity events? If this is true, how best to trigger 3rd party integrations based on user actions?

public class CrmIntegrationConnector : BaseIntegrationConnector
{
    public override void Init()
    {
        this.ConnectorName = GetType().Name;

        SubscribeToObjects(TaskProcessTypeEnum.AsyncSnapshot, PredefinedObjectType.ACTIVITY, TaskTypeEnum.CreateObject);
    }

    public override IntegrationProcessResultEnum ProcessInternalTaskAsync(GeneralizedInfo infoObj, TranslationHelper translations, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName, out string errorMessage)
    {
        try
        {
            if (infoObj.TypeInfo.ObjectType == PredefinedObjectType.ACTIVITY)
            {
                var activity = ((BaseInfo)infoObj) as CMS.OnlineMarketing.ActivityInfo;
            }

            //Set the error message to null and the response to OK
            errorMessage = null;
            return IntegrationProcessResultEnum.OK;
        }
        catch (Exception ex)
        {
            //There was a problem.
            errorMessage = ex.Message;
            return IntegrationProcessResultEnum.ErrorAndSkip;
        }
    }
}

Any ideas why this might be?

Correct Answer

Tom Troughton answered on December 8, 2015 15:26

I've now had an answer from Kentico support. It's simply the case that Activity objects do not support integration bus subscriptions. If you want this behaviour you have to build it yourself using global events.

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.