CsvConnector

javadoc

CsvConnector is a service that reads a comma separated file ( .csv ) and publishes one document for each row. 

 

Example for develop:

#file : CsvConnector.py edit raw

#########################################
# CsvConnector.py
# categories: ingest
# more info @: http://myrobotlab.org/service/CsvConnector
#########################################
# uncomment for virtual hardware
# virtual = True

# crawlers publish documents
def onDocument(doc):
    print(doc)

# start the service
csvconnector = Runtime.start("csvconnector","CsvConnector")

csvconnector.setFilename("crazybigdata.csv")

csvconnector.setColumns("FirstName", "LastName", "Sex", "Occupation", "Address")
csvconnector.setSeparator(";")
csvconnector.addListener("publishDocument","python","onDocument")

# start crawling
csvconnector.startCrawling()

sleep(5)

csvconnector.stopCrawling()