Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

What to put as "Input Schema" for Custom Processors in SAM?

What to put as "Input Schema" for Custom Processors in SAM?

I tried to make a custom Processor for SAM. For testing purposes, I made a processor that just adds another field to a tuple with the name "wasHere" and value 1. This is the source code of the ExampleProcessor.java:

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import com.hortonworks.streamline.streams.StreamlineEvent;
import com.hortonworks.streamline.streams.exception.ConfigException;
import com.hortonworks.streamline.streams.exception.ProcessingException;
import com.hortonworks.streamline.streams.runtime.CustomProcessorRuntime;


public class ExampleProcessor implements CustomProcessorRuntime{


	protected static final Logger LOG = LoggerFactory.getLogger(ExampleProcessor.class);
	
	public void cleanup() {
	}


	public void initialize(Map<String, Object> arg0) {
		// TODO Auto-generated method stub
		
	}


	public List<StreamlineEvent> process(StreamlineEvent myTuple) throws ProcessingException {
		List<StreamlineEvent> liste = new ArrayList<StreamlineEvent>();
		myTuple.addFieldAndValue("wasHere", 1);
		liste.add(myTuple);
		return liste;
	}


	public void validateConfig(Map<String, Object> arg0) throws ConfigException {
		LOG.debug("Config valid ");
	}
}


Now, my problem is, after exporting the maven project as a jar file, I don't really know what to put as Input Schema or Output Schema because the processor shouldn't care what kind of tuple comes in. I then just used the Input Schema from the tutorial but I get the Error Message "Invalid data entered for Input Schema". This is the Schema I use:

{
  "name": "driverId",
  "type": "STRING",
  "optional": false
}

I did not add a config file because this processor is not supposed to get any configs.

EDIT: I tried using the source code from https://github.com/hortonworks/streamline/blob/master/examples/processors/src/main/java/com/hortonwo... and it didn't change anything.

Don't have an account?
Coming from Hortonworks? Activate your account here