Class CSVInputAdapter

All Implemented Interfaces:
com.espertech.esper.runtime.client.util.Adapter, com.espertech.esper.runtime.client.util.InputAdapter, CoordinatedAdapter

public class CSVInputAdapter extends AbstractCoordinatedAdapter implements com.espertech.esper.runtime.client.util.InputAdapter
An event Adapter that uses a CSV file for a source.
  • Constructor Details

    • CSVInputAdapter

      public CSVInputAdapter(com.espertech.esper.runtime.client.EPRuntime runtime, CSVInputAdapterSpec spec)
      Ctor.
      Parameters:
      runtime - - provides the runtimeruntime and services
      spec - - the parameters for this adapter
    • CSVInputAdapter

      public CSVInputAdapter(com.espertech.esper.runtime.client.EPRuntime runtime, AdapterInputSource adapterInputSource, String eventTypeName)
      Ctor.
      Parameters:
      runtime - - provides the runtimeruntime and services
      adapterInputSource - - the source of the CSV file
      eventTypeName - - the type name of the Map event to create from the CSV data
    • CSVInputAdapter

      public CSVInputAdapter(CSVInputAdapterSpec adapterSpec)
      Ctor for adapters that will be passed to an AdapterCoordinator.
      Parameters:
      adapterSpec - contains parameters that specify the behavior of the input adapter
    • CSVInputAdapter

      public CSVInputAdapter(AdapterInputSource adapterInputSource, String eventTypeName)
      Ctor for adapters that will be passed to an AdapterCoordinator.
      Parameters:
      adapterInputSource - - the parameters for this adapter
      eventTypeName - - the event type name that the input adapter generates events for
  • Method Details

    • read

      public SendableEvent read() throws com.espertech.esper.common.client.EPException
      Description copied from interface: CoordinatedAdapter
      Get the next event in line to be sent into the runtime , or null if there is no available event.
      Specified by:
      read in interface CoordinatedAdapter
      Returns:
      an instance of SendableEvent that wraps the next event to send, or null if none
      Throws:
      com.espertech.esper.common.client.EPException - in case of errors creating the event
    • setRuntime

      public void setRuntime(com.espertech.esper.runtime.client.EPRuntime runtime)
      Description copied from interface: CoordinatedAdapter
      Set the runtime
      Specified by:
      setRuntime in interface CoordinatedAdapter
      Overrides:
      setRuntime in class AbstractCoordinatedAdapter
      Parameters:
      runtime - - the value to set
    • setCoercer

      public void setCoercer(AbstractTypeCoercer coercer)
      Sets the coercing provider.
      Parameters:
      coercer - to use for coercing
    • close

      protected void close()
      Close the CSVReader.
      Specified by:
      close in class AbstractCoordinatedAdapter
    • replaceFirstEventToSend

      protected void replaceFirstEventToSend()
      Remove the first member of eventsToSend. If there is another record in the CSV file, insert the event created from it into eventsToSend.
      Specified by:
      replaceFirstEventToSend in class AbstractCoordinatedAdapter
    • reset

      protected void reset()
      Reset all the changeable state of this ReadableAdapter, as if it were just created.
      Specified by:
      reset in class AbstractCoordinatedAdapter
    • getRowCount

      public int getRowCount()
      Returns row count.
      Returns:
      row count