4

I have a scenario where I have to check if there is any change in a particular field of a Component, then I have to call some shell scripts and then move some files from one location to another.

The Publish status of the Component should be marked successful in CMS, only if the operation performed by scripts and file copy operation is successful.

My question is, where exactly should I implement this?

  1. On Publish event of Component
  2. Storage extension
  3. Deployer extension

I want to add some more to my question:- The scripts may take time more than hours. In that case will it be good to use Storage extension.

2
  • Could you elaborate on what files should be moved, are these items published from the CMS that you want to move? Commented Jul 3, 2013 at 9:40
  • These files are not published from CMS. The files which I have to copy from one location to other are on some other location or on other machine on network. One more thing is that I have to compare the current version of component with last published version of the component and then need to perform these tasks.
    – AlokBhatt
    Commented Jul 3, 2013 at 9:45

2 Answers 2

2

I tried to figured out the difference between Deployer Extension and Storage Extension and the various scenario specifying which one to use - may be you want to follow this blog

Considering this specific requirement from your question - The Publish status of the Component should be marked successful in CMS, only if the operation performed by scripts and file copy operation is successful.

I would suggest using the Storage Extension, you will get complete control on the Publishing Transaction and can even send meaningful message to the CME in case of failure. And this particular extension would fulfill all your requirements. However, from Architecture perspective, this might sounds a bit vague to many people as you are not dealing with the Tridion Storage Layer - but with the Deployer Module. However, using Deployer Extension, as you are seeking a lots of control on the Publishing Transaction process, I am not sure how much you will be able to achieve.

6
  • The scripts may take time more than hours. In that case will it be good to use Storage extension?
    – AlokBhatt
    Commented Jul 5, 2013 at 8:42
  • Which script you are talking about? Commented Jul 5, 2013 at 9:54
  • As I said that I have to perform some external operations. These operation are like calling some scripts which will do encryption of some media files which can be of size in GB's. This encryption can take some time and once the encryption is complete than I have to copy encrypted file to some location. Publish status of the item should be updated only if these tasks are successful.
    – AlokBhatt
    Commented Jul 5, 2013 at 12:06
  • For this case, Storage Extension is the only option to go ahead. Commented Jul 5, 2013 at 12:41
  • Can you please tell about impact on publishing of other items? If there will be impact how can we handle that publishing of other items doesn't get impacted. Is it possible to schedule the time of actual deployment of item in storage layer so that we can keep our item to wait until the operations get completed. As we are able to schedule the publish time on an item in Event System or CME, is it possible to schedule deployment of an item?
    – AlokBhatt
    Commented Jul 5, 2013 at 13:55
5

If you want to check a component field value, then it will be easier to do this on the CM side, however if the files that you want to move around are in your web layer, then its probably not practical to run the scripts and move them from a CM-based application.

In order to determine where you should extend, its also important to understand a bit more about what should happen if the shell scripts fail. Should the items that were published then not be stored on the FS/DB, or do we simply want to notify the editor that something went wrong?

Storage extensions give you access to the moment an item is stored to FS/DB, so are a good extension point if you want to do stuff on an item by item basis, and have the ability to interrupt the transaction of storing the content. Deployer extensions operate in a pipeline, so are less integrated with the deployment of individual items, and have no control over the transaction of storing the published items (except if you put your extension first in the pipeline, and throw an error; subsequent deployment processes in the pipeline will not be executed).

For the event system you could look at the SaveEventArgs for PublishTransaction subject- this gives you access to the moments when the status in the Publish Queue is updated.

It might help if you gave a less abstract summary of your requirements.

6
  • Firstly I have to compare the current version of component with the last published version. Secondly The files which I have to move are not managed from CMS and are on some other machine or location. Thirdly If the operation of running scripts or file copy operation fails I have to fail the publishing of the item.
    – AlokBhatt
    Commented Jul 3, 2013 at 9:48
  • Ah - OK, thats a bit different from checking a component field like you say in the question. Its just as easy to check the version of a component on CM and CD side, however checking the last published version will be easier on CD side. It sounds like you should go for a storage extension if you need to tie up the moving of files and the publishing of the item together in a "transaction"
    – Will Price
    Commented Jul 3, 2013 at 9:56
  • One More thing I want to mention here is that I have an xml file which I am publishing from CMS. And last published version of that xml is already there on CDA, So before overwriting that file can I Compare this newly Published file with already published xml file in my storage extension?
    – AlokBhatt
    Commented Jul 3, 2013 at 10:08
  • Yes - in a storage extension you have access to the complete content (in your case the xml data) that is about to be stored, and you know the path it will be stored to, so you can try to pick up the existing xml data from there
    – Will Price
    Commented Jul 3, 2013 at 10:25
  • The scripts may take time more than hours. In that case will it be good to use Storage extension.
    – AlokBhatt
    Commented Jul 5, 2013 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.