Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8832

Why integration bus connector is not fired?

$
0
0
I'm using Kentico MVC v12 with a fresh installation of DancingGoat(MVC) template.I've 2 projects in my solution:CMSApp: the backoffice websiteDancingGoat: the ecommerce websiteMy connector is a C# class that is placed in a folder in CMSApp project.The goal of my connector is to register to execute custom logic each time a user is created.Here is my C# connector code:public class CmsUserIntegrationConnector : BaseIntegrationConnector { /// @summary@ /// Initializes the connector name. /// @/summary@ public override void Init() { // Initializes the connector name (must match the code name of the connector object in the system) // GetType().Name uses the name of the class as the ConnectorName ConnectorName = nameof(CmsUserIntegrationConnector); SubscribeToObjects( TaskProcessTypeEnum.AsyncSimple, PredefinedObjectType.USER, 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.USER.ToString()) { if (taskType == TaskTypeEnum.CreateObject) { EventLogProvider.LogInformation( nameof(CmsUserIntegrationConnector), nameof(ProcessInternalTaskAsync), "User created on SAP !!!!!"); UserInfo user = infoObj.MainObject as UserInfo; // Consume SAP webservice and provider user info // Save SAPId received from webservice in user custom field using (CMSActionContext context = new CMSActionContext()) { context.LogWebFarmTasks = false; context.LogEvents = false; context.LogExport = false; context.LogIntegration = false; context.LogSynchronization = false; // code that creates/saves the object goes here user.SetValue("SAPID", Guid.NewGuid()); // (new Random()).Next(0, 100) UserInfoProvider.SetUserInfo(user); } } } } catch (Exception ex) { EventLogProvider.LogException( nameof(CmsUserIntegrationConnector), nameof(ProcessInternalTaskAsync), ex); errorMessage = ex.Message; return IntegrationProcessResultEnum.Error; } errorMessage = null; return IntegrationProcessResultEnum.OK; } } What happens now:If I create a user in the user module of the backoffice my connector is firedIf I create a user via the ecommerce website, nothing happens..Should I create a library project, put the C# connector class in it and add it as reference in both websites, and maybe doing something more in the configuration ?Am I doing something wrong ?Thank you by advance !

Viewing all articles
Browse latest Browse all 8832

Trending Articles