Tridion 2009 SP1: Custom Page that uses TDSE. Published page stays in publishing queue

StackOverflow https://stackoverflow.com/questions/10850636

  •  12-06-2021
  •  | 
  •  

Question

I am writing a custom page for Tridion 2009 SP 1 that publishes a page based on the query string, which will be called from a scheduled task.

I am using the following code:

string pageId = Request.QueryString["page_id"];
string targetId = Request.QueryString["publication_target_id"];

if (string.IsNullOrEmpty(pageId))
{
    Response.Write("This page is intended to be called automatically with a " +
                 + "page id and publication target id");
    return;
}

TDSE tdse = new TDSE();
string publicationId = pageId.Split('-')[0].Substring(4);
var publication = tdse.GetPublication("tcm:0-" + publicationId + "-1");
var page = tdse.GetPage(pageId, publication);
var target = tdse.GetPublicationTarget(targetId);
page.Publish(target, true, false, true);

Response.Write("Successfully published " + page.Title + " to " + target.Title);

This seems to work and I can see the Page(s) in the queue but they remain in the "In progress" state.

I can still publish pages manually with no issues.

The deployer log shows that it is not receiving the work however I can see the items in the c:\tridion\work folder (I'm using the local file system pub target).

Any ideas?

Update: here's the publish log when the Publisher was running like TcmPublisher /debug

01/06/2012 14:34:17 <5440> [Publisher]              Queue message [769571] is retrieved from Queue consumer handler for PublishQueue
01/06/2012 14:34:17 <4896> [Publisher]              Queue message handler for PublishQueue [0] working on queue message 769571
01/06/2012 14:34:17 <4896> [DefaultPublishTransactionHandler]   Handling publish transaction [tcm:0-93950-66560]
01/06/2012 14:34:17 <4896> [DefaultPublishTransactionHandler]   Publishing item [tcm:32-206093-64] from publication [tcm:0-32-1] to target [tcm:0-1-65537]
01/06/2012 14:34:17 <4896> [Transporting]           Storage location: c:\tridion\incoming\tcm_0-93950-66560.Content\
01/06/2012 14:34:17 <4896> [Resolve engine]             Getting resolver(s) for item type Tridion.ContentManager.CommunicationManagement.Page
01/06/2012 14:34:17 <4896> [Resolve engine]             Using resolver [Tridion.ContentManager.Publishing.Legacy.Resolving.PageResolver]
01/06/2012 14:34:17 <4896> [Legacy resolving]           Resolving the page [tcm:32-206093-64] took 00:00:00.0136441
01/06/2012 14:34:17 <4896> [Legacy resolving]           Resolved page [tcm:32-206093-64] with title 'Website Redirects'
01/06/2012 14:34:17 <4896> [DefaultPublishTransactionHandler]   Resolving took: 00:00:00.0468768
01/06/2012 14:34:17 <4896> [Render engine]              Getting renderer(s) for item type Tridion.ContentManager.CommunicationManagement.Page and template type CompoundTemplate
01/06/2012 14:34:17 <4896> [Render engine]              Using renderer [Tridion.ContentManager.Templating.TemplatingRenderer]
01/06/2012 14:34:17 <4896> [Render engine]              Getting renderer(s) for item type Tridion.ContentManager.ContentManagement.Component and template type CompoundTemplate
01/06/2012 14:34:17 <4896> [Render engine]              Using renderer [Tridion.ContentManager.Templating.TemplatingRenderer]
01/06/2012 14:34:17 <4896> [Render engine]              Rendering took: 00:00:00.2469570
01/06/2012 14:34:17 <4896> [Render engine]              Emmbed the result of this rendered component presentation with a tcdl:ComponentPresentation link for component [tcm:32-206079] with template [tcm:32-206080-32]
01/06/2012 14:34:17 <4896> [Render engine]              Rendering took: 00:00:00.3473678
01/06/2012 14:34:17 <4896> [Transporting]           Adding rendered item to the transport package: item [tcm:32-206093-64] 'Website Redirects' with template [tcm:32-206092-128] 'z_Htaccess Template'
01/06/2012 14:34:17 <4896> [Transporting]           Using transport package handler: Tridion.ContentManager.Publishing.Transporting.DefaultPageHandler
01/06/2012 14:34:17 <4896> [Transporting]           Adding Page tcm:32-206093-64 to the transport package for publishing
01/06/2012 14:34:17 <4896> [Transporting]           Writing file: c:\tridion\incoming\tcm_0-93950-66560.Content\Pages\site\us\redirects.htaccess
01/06/2012 14:34:18 <4896> [Transporting]           Adding rendered item to the transport package: item [tcm:32-206079] 'Redirects' with template [tcm:32-206080-32] 'HtAccess Url Redirects'
01/06/2012 14:34:18 <4896> [Transporting]           Using transport package handler: Tridion.ContentManager.Publishing.Transporting.DefaultComponentHandler
01/06/2012 14:34:18 <4896> [Transporting]           Add component [tcm:32-206079] with template [tcm:32-206080-32] to the transport package for publishing
01/06/2012 14:34:18 <4896> [Transporting]           Add schema [tcm:32-190-8] to the transport package for publishing
01/06/2012 14:34:18 <4896> [Transporting]           Building path for No (tcm:3-64-1024)
01/06/2012 14:34:18 <4896> [Transporting]           Building path for Yes (tcm:3-63-1024)
01/06/2012 14:34:18 <4896> [Transporting]           Add binary [tcm:0-0-0] with filename '.htaccess' and path '\site\us\.htaccess' to the transport package for publishing
01/06/2012 14:34:18 <4896> [DefaultPublishTransactionHandler]   Updating the publish transaction with the list of processed items
01/06/2012 14:34:18 <4896> [Transporting]           Saving the transport package
01/06/2012 14:34:18 <4896> Sending deploy control [Commit] for transaction [tcm:0-93950-66560] to deployer.
01/06/2012 14:34:18 <4896> [DefaultPublishTransactionHandler]   Publish transaction took 00:00:00.6889970
01/06/2012 14:34:18 <4896> [Publisher]              Cache statistics: SimpleCache: 14 Regions, 17 Objects, 20 Hits, 17 Misses
01/06/2012 14:34:18 <4896>  Region 'Component': 1 Objects, 6 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'PublishTransaction': 1 Objects, 1 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'PublicationTarget': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Page': 1 Objects, 3 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Publication': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Tdse': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'User': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'PageTemplate': 1 Objects, 2 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'TemplateBuildingBlock': 3 Objects, 5 Hits, 3 Misses.
01/06/2012 14:34:18 <4896>  Region 'ComponentTemplate': 1 Objects, 2 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'StructureGroup': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Schema': 1 Objects, 0 Hits, 1 Misses.
01/06/2012 14:34:18 <4896>  Region 'Keyword': 2 Objects, 0 Hits, 2 Misses.
01/06/2012 14:34:18 <4896>  Region 'Category': 1 Objects, 1 Hits, 1 Misses.
01/06/2012 14:34:18 <5440> [Publisher]              Deleting queue message: 769571 from Queue consumer handler for PublishQueue
Was it helpful?

Solution

This is pretty odd, I can't understand what the difference would be.

Have you tried enabling Publisher Logs? Or even better, run the publisher in debug mode (tcmpublisher /debug) and try to figure out what's going on. Since it's stuck "In Progress" chances are that the publisher is the responsible for this.

OTHER TIPS

My immediate suspicion is that you are doing something different on the CM side. Otherwise it's difficult to account for the success of manual publishing.

You say you can publish pages manually without problems. Can you confirm that it works for the same pages that fail via the custom page?

And of course the next question is whether the publication targets are the same. When publishing by hand, of course, you select a target type, but when using the API, you can select either a target type or a publication target. The text says you should be using a publication target. Are you? And is it the same publication target that's wired up to the Target type you used manually? (Of course, by the time it reaches the deployer logs, there's only a publication target.)

You have specified ActivateBlueprinting and RollbackOnFailure. Do these settings reflect what you did in your manual test? (So is publication 32 the one you published to or a child?)

"I can see the items in the c:\tridion\work folder" - do you see the unzipped transport package, or something else?

Do you have the Deployer logging in DEBUG?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top