Class FetcherThreadEvent

java.lang.Object
org.apache.nutch.fetcher.FetcherThreadEvent
All Implemented Interfaces:
Serializable

public class FetcherThreadEvent extends Object implements Serializable
This class is used to capture the various events occurring at fetch time. These events are sent to a NutchPublisher implementation.
See Also:
  • Constructor Details

    • FetcherThreadEvent

      public FetcherThreadEvent(FetcherThreadEvent.PublishEventType eventType, String url)
      Constructor to create an event to be published
      Parameters:
      eventType - Type of event being created
      url - URL of the fetched page to which this event belongs to
  • Method Details

    • getEventType

      public FetcherThreadEvent.PublishEventType getEventType()
      Get type of this event object
      Returns:
      Event type
    • setEventType

      public void setEventType(FetcherThreadEvent.PublishEventType eventType)
      Set event type of this object
      Parameters:
      eventType - Set event type
    • getEventData

      public Map<String,Object> getEventData()
      Get event data
      Returns:
      a Map of event data
    • setEventData

      public void setEventData(Map<String,Object> eventData)
      Set metadata to this even
      Parameters:
      eventData - A map containing important information relevant to this event (fetched page). Exeample - score, title, outlinks, content-type, etc
    • getUrl

      public String getUrl()
      Get URL of this event
      Returns:
      URL of this event
    • setUrl

      public void setUrl(String url)
      Set URL of this event (fetched page)
      Parameters:
      url - URL of the fetched page
    • addEventData

      public void addEventData(String key, Object value)
      Add new data to the eventData object.
      Parameters:
      key - A key to refer to the data being added to this event
      value - Data to be stored in the event referenced by the above key
    • addOutlinksToEventData

      public void addOutlinksToEventData(Collection<Outlink> links)
      Given a collection of lists this method will add it the oultink metadata
      Parameters:
      links - A collection of outlinks generating from the fetched page this event refers to
    • getTimestamp

      public Long getTimestamp()
      Get timestamp of current event.
      Returns:
      Timestamp
    • setTimestamp

      public void setTimestamp(Long timestamp)
      Set timestamp for this event
      Parameters:
      timestamp - Timestamp of the occurrence of this event