Thanks Trevor, Timothy Fenton from Kentico support said a similar thing:
This setup actually looks perfectly fine, chances are it is getting processed before you even refresh the integration bus queue. You should make sure you have disabled the processing of these incoming tasks in Settings > Integration > Integration bus. Once this is disabled try hitting the webapi enpoint again with the object and see what happens. Chances are it will be logged just fine, especially since you are not even using the object that you are passing it, just giving it some test value. I configured a setup just like this for testing purposes and it works as expected.
So I unticked the 'process incoming' for the Integration Bus and it still didn't work. However, upon poking around some more, I saw a yellow warning triangle on my connector in the the CMS Integration Bus > Connectors. I'd had mispelt the codename!
Stupid error, but it's strange that the first part of the connector was properly breaking... so Kentico must have been finding the code. Because the breakpoint was being hit, I was working under the assumption that the connector was properly registered. ARgh.
So in case someone needs help with the code:
The web api service receives xml. I loop through the xml and extract the documents I need to process. For EACH document I stick the data from the xml into a simple struct to hold the incoming info:
public struct LightReportOrCategory
{
public int SourceId;
public int SourceParentId;
public int KenticoId;
public int KenticoParentId;
public string ClassName;
public string Name;
public string Description;
public bool Popular;
public DateTime LastModified;
public DateTime CreatedDate;
public string Url;
}
Then I call the enqueuing function (lrc is the struct info):
IntegrationHelper.ProcessExternalTask("ReportIntegrationConnector", lrc, IntegrationProcessTypeEnum.SkipOnError, CMS.DataEngine.TaskTypeEnum.CreateDocument, TaskDataTypeEnum.Simple, SiteContext.CurrentSite.SiteName);
This immediately calls the Connector, in which I extract the info from the struct and assign to the TreeNode:
public override ICMSObject PrepareInternalObject(object obj, TaskTypeEnum taskType, TaskDataTypeEnum dataType, string siteName)
{
// This method is called withing IntegrationHelper.ProcessExternalTask and it provides you with space where you can easily transform
// external object (possibly some kind of data container) to TreeNode (document) or GeneralizedInfo (object - eg. UserInfo)
var lroc = (CMSAppAppCode.Api.LightReportOrCategory)obj;
CMS.DocumentEngine.TreeNode node = null;
if(taskType == TaskTypeEnum.CreateDocument)
node = CMS.DocumentEngine.TreeNode.New(lroc.ClassName);
else
{
var tree = new CMS.DocumentEngine.TreeProvider();
node = tree.SelectSingleNode(lroc.KenticoId);
}
node.DocumentName = lroc.Name;
node.DocumentCulture = "en-US";
node.SetValue("sourceId", lroc.SourceId);
node.SetValue("Name", lroc.Name);
node.SetValue("Description", lroc.Description);
node.DocumentPublishTo = DateTime.UtcNow.AddYears(-1);//automatically unpublish
//Reports have some extra attributes to set:
if (lroc.ClassName == "custom.LibReports")
{
node.SetValue("popular", lroc.Popular);
node.SetValue("LastModified", lroc.LastModified);
node.SetValue("CreatedDate", lroc.CreatedDate);
node.SetValue("Url", lroc.Url);
}
if(lroc.KenticoParentId >0)
node.NodeParentID = lroc.KenticoParentId;
else
{
if(node.NodeParentID <1)//set to the 'uncategorized' category
{
var tree = new CMS.DocumentEngine.TreeProvider();
var nspUncat = new CMS.DocumentEngine.NodeSelectionParameters() { Where = "nodeGuid='d2803fab-1c69-43a8-aac2-c2ce541c2ae8'" };//'uncategorized' node guid=d2803fab-1c69-43a8-aac2-c2ce541c2ae8
var reportsUncategorizedNode = tree.SelectSingleNode(nspUncat);
node.NodeParentID = reportsUncategorizedNode.NodeID;
}
}
The Task then gets immediately enqueued in the incoming queue for the Integration Bus.