[ 
https://issues.apache.org/jira/browse/METRON-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16672338#comment-16672338
 ] 

ASF GitHub Bot commented on METRON-1850:
----------------------------------------

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

    https://github.com/apache/metron/pull/1250#discussion_r230227817
  
    --- Diff: 
metron-platform/metron-common/src/main/java/org/apache/metron/common/bolt/ConfiguredEnrichmentBolt.java
 ---
    @@ -17,18 +17,41 @@
      */
     package org.apache.metron.common.bolt;
     
    +import java.io.IOException;
     import java.lang.invoke.MethodHandles;
    +import java.util.Map;
    +
    +import org.apache.http.impl.client.CloseableHttpClient;
     import org.apache.metron.common.configuration.EnrichmentConfigurations;
    +import org.apache.metron.stellar.common.utils.HttpClientUtils;
    +import org.apache.storm.task.OutputCollector;
    +import org.apache.storm.task.TopologyContext;
     import org.slf4j.Logger;
     import org.slf4j.LoggerFactory;
     
     public abstract class ConfiguredEnrichmentBolt extends 
ConfiguredBolt<EnrichmentConfigurations> {
     
       private static final Logger LOG = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
     
    +  protected CloseableHttpClient httpClient;
     
       public ConfiguredEnrichmentBolt(String zookeeperUrl) {
         super(zookeeperUrl, "ENRICHMENT");
       }
     
    +  @Override
    +  public void prepare(Map stormConf, TopologyContext context, 
OutputCollector collector) {
    +    super.prepare(stormConf, context, collector);
    --- End diff --
    
    I tried that initially but realized there is no shutdown hook in Stellar.  
HttpClient objects need to be closed and the only hook that exists is in the 
bolts.  
    
    If we did have a way to close it, I would be in favor of managing it in the 
function.  If we decide it's worth adding that hook in Stellar (I think we 
should as a follow on) we can easily move this inside the function.


> Stellar REST function
> ---------------------
>
>                 Key: METRON-1850
>                 URL: https://issues.apache.org/jira/browse/METRON-1850
>             Project: Metron
>          Issue Type: New Feature
>            Reporter: Ryan Merriman
>            Priority: Major
>
> It would be useful to be able to enrich messages with Stellar using 3rd party 
> (or internal) REST services.  At a minimum this function would:
>  * Stellar function available to GET from an HTTP API
>  * Optional parameters for basic auth (user/password) which generate correct 
> Authorization header
>  * Function returns null value for errors, connection failures etc and logs 
> error
>  * Function must provide and use pooled connection objects at the process 
> level
>  * Function must send Accept: application/json header
>  * A global setting must be available to set a proxy for all API calls, and 
> if present the proxy must be used.
>  * Proxy authentication must also be supported using basic auth.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to