metron-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From duchuyctlk <...@git.apache.org>
Subject [GitHub] incubator-metron pull request #483: Metron-765 Add GUID to messages
Date Sun, 19 Mar 2017 17:59:33 GMT
Github user duchuyctlk commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/483#discussion_r106813691
  
    --- Diff: metron-platform/metron-enrichment/src/main/java/org/apache/metron/enrichment/bolt/EnrichmentSplitterBolt.java
---
    @@ -61,16 +61,20 @@ public void prepare(Map map, TopologyContext topologyContext) {
       }
       @Override
       public String getKey(Tuple tuple, JSONObject message) {
    -    String key = null;
    +    String key = null, guid = null;
         try {
           key = tuple.getStringByField("key");
    +      guid = (String)message.get(Constants.GUID);
         }
         catch(Throwable t) {
           //swallowing this just in case.
         }
         if(key != null) {
    --- End diff --
    
    Can ternary simplify this `if-else` statement?
    
    ```java
    return key != null ? key : (guid != null : guid : UUID.randomUUID().toString());
    ```
    



---
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