org.apache.nutch.fetcher

## Class FetcherThreadEvent

- java.lang.Object
- - org.apache.nutch.fetcher.FetcherThreadEvent

- All Implemented Interfaces:
    java.io.Serializable

      public class FetcherThreadEvent
      extends java.lang.Object
      implements java.io.Serializable

  This class is used to capture the various events occurring at fetch time. These events are sent to a queue implementing the publisher
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `FetcherThreadEvent.PublishEventType` Type of event to specify start, end or reporting of a fetch item.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FetcherThreadEvent(FetcherThreadEvent.PublishEventType eventType, java.lang.String url)` Constructor to create an event to be published

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addEventData(java.lang.String key, java.lang.Object value)` Add new data to the eventData object.
    `void` | `addOutlinksToEventData(java.util.Collection<Outlink> links)` Given a collection of lists this method will add it the oultink metadata
    `java.util.Map<java.lang.String,java.lang.Object>` | `getEventData()` Get event data
    `FetcherThreadEvent.PublishEventType` | `getEventType()` Get type of this event object
    `java.lang.Long` | `getTimestamp()` Get timestamp of current event.
    `java.lang.String` | `getUrl()` Get URL of this event
    `void` | `setEventData(java.util.Map<java.lang.String,java.lang.Object> eventData)` Set metadata to this even
    `void` | `setEventType(FetcherThreadEvent.PublishEventType eventType)` Set event type of this object
    `void` | `setTimestamp(java.lang.Long timestamp)` Set timestamp for this event
    `void` | `setUrl(java.lang.String url)` Set URL of this event (fetched page)

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FetcherThreadEvent

          public FetcherThreadEvent(FetcherThreadEvent.PublishEventType eventType,
                                    java.lang.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 Detail

    - #### 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 java.util.Map<java.lang.String,java.lang.Object> getEventData()

      Get event data
      Returns:

    - #### setEventData

          public void setEventData(java.util.Map<java.lang.String,java.lang.Object> eventData)

      Set metadata to this even
      Parameters:
        `eventData` - A map containing important information relevant to this event (fetched page). Ex - score, title, outlinks, content-type, etc

    - #### getUrl

          public java.lang.String getUrl()

      Get URL of this event
      Returns:
        `URL` of this event

    - #### setUrl

          public void setUrl(java.lang.String url)

      Set URL of this event (fetched page)
      Parameters:
        `url` - URL of the fetched page

    - #### addEventData

          public void addEventData(java.lang.String key,
                                   java.lang.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(java.util.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 java.lang.Long getTimestamp()

      Get timestamp of current event.
      Returns:
        `Timestamp`

    - #### setTimestamp

          public void setTimestamp(java.lang.Long timestamp)

      Set timestamp for this event
      Parameters:
        `timestamp` - Timestamp of the occurrence of this event

Copyright © 2019 The Apache Software Foundation