Github user srdo commented on a diff in the pull request:

    https://github.com/apache/storm/pull/2443#discussion_r155515549
  
    --- Diff: 
sql/storm-sql-external/storm-sql-mongodb/src/jvm/org/apache/storm/sql/mongodb/MongoDataSourcesProvider.java
 ---
    @@ -49,53 +46,56 @@
      */
     public class MongoDataSourcesProvider implements DataSourcesProvider {
     
    -    private static class MongoTridentDataSource implements 
ISqlTridentDataSource {
    +    private static class MongoStreamsDataSource implements 
ISqlStreamsDataSource {
             private final String url;
             private final Properties props;
             private final IOutputSerializer serializer;
     
    -        private MongoTridentDataSource(String url, Properties props, 
IOutputSerializer serializer) {
    +        private MongoStreamsDataSource(String url, Properties props, 
IOutputSerializer serializer) {
                 this.url = url;
                 this.props = props;
                 this.serializer = serializer;
             }
     
             @Override
    -        public ITridentDataSource getProducer() {
    +        public IRichSpout getProducer() {
                 throw new 
UnsupportedOperationException(this.getClass().getName() + " doesn't provide 
Producer");
             }
     
             @Override
    -        public SqlTridentConsumer getConsumer() {
    +        public IRichBolt getConsumer() {
                 Preconditions.checkArgument(!props.isEmpty(), "Writable 
MongoDB must contain collection config");
    -            String serField = props.getProperty("trident.ser.field", 
"tridentSerField");
    -            MongoMapper mapper = new TridentMongoMapper(serField, 
serializer);
     
    -            MongoState.Options options = new MongoState.Options()
    -                    .withUrl(url)
    -                    
.withCollectionName(props.getProperty("collection.name"))
    -                    .withMapper(mapper);
    +            String serField;
    +            if (props.contains("ser.field")) {
    +                serField = props.getProperty("ser.field");
    +            } else if (props.contains("trident.ser.field")) {
    --- End diff --
    
    Nit: Are there constants somewhere that could be used instead of literals?


---

Reply via email to