How to Abort a Commerce Server Catalog Import Part II

A couple months ago I wrote a post about a dirty way of aborting a Commerce Server catalog import which involved stopping SQL Server and various other invasive procedures. Tonight I found out there is at least one but maybe two ways of doing this, one supported and other basically a hack.  
 
First for the supported way. I was able to dig up this API method for cancelling an import as part of the ImportProgress class. It seems like the cancel method would be on a catalog import class rather than on the progress tracking class but I am just glad to know there is a supported way: http://msdn.microsoft.com/en-us/library/microsoft.commerceserver.catalog.importprogress.abort(CS.70).aspx. Once I can build a utility class to do this I will post it here.
 
I did find another approach that seemed to work too. A colleague suggested looking at the CatalogStatus table in the productcatalog table to watch the status of the imports. When looking at this table I noticed the AbortRequested field which is a bit flag that can be set to cancel a pending or ongoing import. It seemed like this would be documented better and I did find a small amount of information on this field: http://msdn.microsoft.com/en-us/library/bb509008(CS.70).aspx. I set the field to 1 in order to stop some pending imports and they did not start. The statement to run is based on the StatusId column which seems to hold an arbitrary value so I am not sure if it is possible to get this value from somewhere else. So you would run something like this to cancel a catalog import with a StatusId of 1:
 
Update [MyCommerceSite_productcatalog].[dbo].[CatalogStatus]
Set AbortRequested = 1
Where StatusId = 1
 
Again, I wish this were documented better but was quite glad to have at least a hack to save me a couple hours waiting for some imports to finish. Thanks!
Advertisements

,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: