streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steveblackmon <...@git.apache.org>
Subject [GitHub] incubator-streams pull request: Resolves STREAMS-134
Date Tue, 05 Aug 2014 14:43:49 GMT
Github user steveblackmon commented on a diff in the pull request:

    https://github.com/apache/incubator-streams/pull/61#discussion_r15816683
  
    --- Diff: streams-contrib/streams-persist-elasticsearch/src/main/java/org/apache/streams/elasticsearch/ElasticsearchConfigurator.java
---
    @@ -78,28 +78,14 @@ public static ElasticsearchReaderConfiguration detectReaderConfiguration(Config
     
         public static ElasticsearchWriterConfiguration detectWriterConfiguration(Config elasticsearch)
{
     
    -        ElasticsearchConfiguration elasticsearchConfiguration = detectConfiguration(elasticsearch);
    -        ElasticsearchWriterConfiguration elasticsearchWriterConfiguration = mapper.convertValue(elasticsearchConfiguration,
ElasticsearchWriterConfiguration.class);
    -
    -        String index = elasticsearch.getString("index");
    -        String type = elasticsearch.getString("type");
    -        Long maxMsBeforeFlush = elasticsearch.hasPath("MaxTimeBetweenFlushMs") ? elasticsearch.getLong("MaxTimeBetweenFlushMs")
: null;
    -
    -        if( elasticsearch.hasPath("bulk"))
    -            elasticsearchWriterConfiguration.setBulk(elasticsearch.getBoolean("bulk"));
    -
    -        if( elasticsearch.hasPath("batchSize"))
    -            elasticsearchWriterConfiguration.setBatchSize(elasticsearch.getLong("batchSize"));
    -
    -        if( elasticsearch.hasPath("batchBytes"))
    -            elasticsearchWriterConfiguration.setBatchBytes(elasticsearch.getLong("batchBytes"));
    -
    -
    -        elasticsearchWriterConfiguration.setIndex(index);
    -        elasticsearchWriterConfiguration.setType(type);
    -        elasticsearchWriterConfiguration.setMaxTimeBetweenFlushMs(maxMsBeforeFlush);
    -
    +        ElasticsearchWriterConfiguration elasticsearchWriterConfiguration = null;
     
    +        try {
    +            elasticsearchWriterConfiguration = mapper.readValue(elasticsearch.root().render(ConfigRenderOptions.concise()),
ElasticsearchWriterConfiguration.class);
    --- End diff --
    
    this syntax works regardless of whether the config is supplied via json, hocon, or properties.
 very handy.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message