use of org.apache.storm.spout.Scheme in project storm by apache.
the class SocketDataSourcesProvider method constructStreams.
@Override
public ISqlStreamsDataSource constructStreams(URI uri, String inputFormatClass, String outputFormatClass, Properties properties, List<FieldInfo> fields) {
String host = uri.getHost();
int port = uri.getPort();
if (port == -1) {
throw new RuntimeException("Port information is not available. URI: " + uri);
}
List<String> fieldNames = FieldInfoUtils.getFieldNames(fields);
Scheme scheme = SerdeUtils.getScheme(inputFormatClass, properties, fieldNames);
IOutputSerializer serializer = SerdeUtils.getSerializer(outputFormatClass, properties, fieldNames);
return new SocketDataSourcesProvider.SocketStreamsDataSource(host, port, scheme, serializer);
}
use of org.apache.storm.spout.Scheme in project storm by apache.
the class RocketMqUtils method createScheme.
/**
* Create Scheme by Properties.
* @param props Properties
* @return Scheme
*/
public static Scheme createScheme(Properties props) {
String schemeString = props.getProperty(SpoutConfig.SCHEME, SpoutConfig.DEFAULT_SCHEME);
Scheme scheme;
try {
Class clazz = Class.forName(schemeString);
scheme = (Scheme) clazz.newInstance();
} catch (Exception e) {
throw new IllegalArgumentException("Cannot create Scheme for " + schemeString + " due to " + e.getMessage());
}
return scheme;
}
Aggregations