Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

AEM Feed Importer for latest AEM Versions?

Avatar

Level 4

Dear Community,

 

Is the Feed importer feature available still on AEM? I tried using the classic UI but even that (at least using purely UI) does not seem to work. My questions here are:

  1. Is there a workaround for this, to make the feed importer work?
  2. If not, what is the best way to create a custom e.g. RSS feed importer (although it would sound like re-inventing the wheel, considering the feature used to be there)?

I am looking into AEM 6.5+ or AEM as a Cloud Service offerings.

 

Thank you in advance.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @kimonp31365843,

You can create custom implementation for Importer. Please find below for the details.

 

We should create a config (nt:unstructured node with mixin - cq:PollConfig) with properties as source, target and interval in either /etc or /content. Sample screenshot attached. 

 

format for property, source : scheme:datasource where

  • scheme mentioned here in config should match the custom implementation property - Importer.SCHEME_PROPERTY.
  • datasource : Desired rss feed. Example : I have considered cricket info. 

In the implementation class, importData method has all the details as part of the poll config(have attached log screenshot) using which we can frame the desired logic. 

Vijayalakshmi_S_0-1632410765456.png

 

package com.aem.demoproject.core.services.impl;

import com.day.cq.polling.importer.ImportException;
import com.day.cq.polling.importer.Importer;
import org.apache.sling.api.resource.Resource;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component(service = Importer.class, property = {Importer.SCHEME_PROPERTY + "=customImporter"})
public class CustomPollingImporter implements Importer {

    private static final Logger LOG = LoggerFactory.getLogger(CustomPollingImporter.class);

    @Override
    public void importData(String scheme, String datasource, Resource resource) throws ImportException {
        LOG.info("Scheme={},  data source={} and target repo path={} ", scheme, datasource, resource.getPath());
        /* Logic to Parse the data source XML and write to target repo path */
    }

    @Override
    public void importData(String s, String s1, Resource resource, String s2, String s3) throws ImportException {

    }
}

Vijayalakshmi_S_1-1632410844573.png

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @kimonp31365843,

You can create custom implementation for Importer. Please find below for the details.

 

We should create a config (nt:unstructured node with mixin - cq:PollConfig) with properties as source, target and interval in either /etc or /content. Sample screenshot attached. 

 

format for property, source : scheme:datasource where

  • scheme mentioned here in config should match the custom implementation property - Importer.SCHEME_PROPERTY.
  • datasource : Desired rss feed. Example : I have considered cricket info. 

In the implementation class, importData method has all the details as part of the poll config(have attached log screenshot) using which we can frame the desired logic. 

Vijayalakshmi_S_0-1632410765456.png

 

package com.aem.demoproject.core.services.impl;

import com.day.cq.polling.importer.ImportException;
import com.day.cq.polling.importer.Importer;
import org.apache.sling.api.resource.Resource;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component(service = Importer.class, property = {Importer.SCHEME_PROPERTY + "=customImporter"})
public class CustomPollingImporter implements Importer {

    private static final Logger LOG = LoggerFactory.getLogger(CustomPollingImporter.class);

    @Override
    public void importData(String scheme, String datasource, Resource resource) throws ImportException {
        LOG.info("Scheme={},  data source={} and target repo path={} ", scheme, datasource, resource.getPath());
        /* Logic to Parse the data source XML and write to target repo path */
    }

    @Override
    public void importData(String s, String s1, Resource resource, String s2, String s3) throws ImportException {

    }
}

Vijayalakshmi_S_1-1632410844573.png