TransWikia.com

Setting up a custom deployer extension

Tridion Asked by nguyenv9 on September 30, 2021

So I am currently very new to SDL Tridion and was wondering if I could get some assistance with getting started with setting up a Custom Deployer Extension. I am not exactly sure what I need besides getting my JAVA IDE chosen. When a content author publishes a specific content component, then that item will publish out to the normal SDL Tridion Deployer. Then a new deployer extension will be created that looks for the specific component type and will process all the content fields and metadata fields in the content component and save the items into DynamoDB. Any assistance would be greatly appreciated!

3 Answers

To piggyback on Saurabh's answer, a storage extension would be a better choice for your use case. A storage extension would better handle storing published items to any storage medium besides the standard content data store.

In the example below, I have shown how component presentations can be stored in a MongoDB server besides the standard content data store. If it is component presentations that need to be stored, your custom class needs to extend JPAComponentPresentationDAO and implement ComponentPresentationDAO and should be in the com.tridion.storage package. You would need to add your own custom logic to have items sent to a storage medium when items are published in the create method. You would also need to implement custom logic to handle updates and deletes in the update and remove methods. Similarly, other item types such as pages, components, etc. can be sent to any storage medium by extending and implementing appropriate classes.

@Component("MongoDBComponentPresentationDAO")
@Scope("prototype")
public class MongoDBComponentPresentationDAO extends JPAComponentPresentationDAO implements ComponentPresentationDAO {
    protected static Logger log = LoggerFactory.getLogger(MongoDBComponentPresentationDAO.class);  

    public MongoDBComponentPresentationDAO(String storageId, EntityManagerFactory entityManagerFactory,
            EntityManager entityManager, String storageType) {
        super(storageId, entityManagerFactory, entityManager, storageType);
    }

    public MongoDBComponentPresentationDAO(String storageId,
            EntityManagerFactory entityManagerFactory, String storageType) {
        super(storageId, entityManagerFactory, storageType);
        // TODO Auto-generated constructor stub         
    }

    @Override
    public void create(ComponentPresentation componentPresentation,
            ComponentPresentationTypeEnum componentPresentationType)
            throws StorageException {
        super.create(componentPresentation, componentPresentationType);

        // Send component presentations to a MongoDB server
        try {
            MongoDBRepository mongoDBRepository = new MongoDBRepository();
            DBObject dbObject = ComponentPresentationAdaptor.toDBObject(componentPresentation);    
            mongoDBRepository.Insert(dbObject);
        } catch (Exception e) {
            throw new StorageException(e.getMessage());
        }
    }

    @Override
    public void remove(ComponentPresentation itemToRemove,
            ComponentPresentationTypeEnum componentPresentationType)
            throws StorageException {
        // TODO Auto-generated method stub
        super.remove(itemToRemove, componentPresentationType);
    }

    @Override
    public void remove(int publicationId, int componentId,
            int componentTemplateId,
            ComponentPresentationTypeEnum componentPresentationType)
            throws StorageException {
        // TODO Auto-generated method stub
        super.remove(publicationId, componentId, componentTemplateId, componentPresentationType);
    }

    @Override
    public void update(ComponentPresentation itemToUpdate,
            ComponentPresentationTypeEnum componentPresentationType)
            throws StorageException {
        // TODO Auto-generated method stub
        super.update(itemToUpdate, componentPresentationType);
    }
}

The docs provide information about to configure the cd_storage_conf.xml to use this custom storage extension. The JARs that need to be added can be found in the lib folder of the deployer service.

Answered by Sabarish Senthilnathan on September 30, 2021

Instead of focussing on which database you want, maybe you should read about the tridion content delivery microservices. The content delivery api supports an mvc model sevice and graphql.

Answered by Chris Mills on September 30, 2021

Welcome to the community.

Please read the official SDL documentation to set up a deployed extension here. Also, there is this cool blog by @hemkant explaining step by step to set up a deployed extension.

I'd also suggest having a look at the storage extension option it might suit you better.

We also have SI4T which provides a generic framework for integration of the SDL Tridion CMS with front-end search engines by indexing the published content to external data storage. This is basically a storage extension based solution, you can take reference from here or extend it according to your needs.

Hope this helps!

Answered by Saurabh Gangwar on September 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP