Issue 16600

New API method: Trigger a dataset crawl

16600
Reporter: trobertson
Assignee: trobertson
Type: Improvement
Summary: New API method: Trigger a dataset crawl
Priority: Major
Resolution: Invalid
Status: Resolved
Created: 2014-10-28 14:10:42.742
Updated: 2014-10-28 14:23:14.589
Resolved: 2014-10-28 14:23:14.534
        
Description: Users who register DwC-A through the API would like the ability to trigger a recrawl, when they change it.  Guido Sautter of Plazi requested this in person at TDWG.

Propose add:
  @AuthorizedAs(RoleRegistryManager)
  GET /dataset//crawl

Internally, this would simply send a StartCrawlMessage]]>
    


Author: trobertson@gbif.org
Created: 2014-10-28 14:20:10.386
Updated: 2014-10-28 14:20:10.386
        
I knew this all sounded familiar... it already exists.
{code}
  /**
   * This is a REST only (e.g. not part of the Java API) method that allows the registry console to trigger the
   * crawling of the dataset. This simply emits a message to rabbitmq requesting the crawl, and applies
   * necessary security.
   */
  @POST
  @Path("{key}/crawl")
  @RolesAllowed({ADMIN_ROLE, EDITOR_ROLE})
  public void crawl(@PathParam("key") UUID datasetKey) {
    if (messagePublisher != null) {
      LOG.info("Requesting crawl of dataset[{}]", datasetKey);
      try {
        // we'll bump this to the top of the queue since it is a user initiated
        messagePublisher.send(new StartCrawlMessage(datasetKey, Priority.CRITICAL));
      } catch (IOException e) {
        LOG.error("Unable to send message requesting crawl", e);
      }

    } else {
      LOG.warn("Registry is configured to run without messaging capabilities.  Unable to crawl dataset[{}]",
        datasetKey);
    }
  }
{code}
    


Author: trobertson@gbif.org
Comment: Created in error - this function already exists.
Created: 2014-10-28 14:23:14.58
Updated: 2014-10-28 14:23:14.58