[
https://issues.apache.org/jira/browse/METRON-1850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16672277#comment-16672277
]
ASF GitHub Bot commented on METRON-1850:
----------------------------------------
Github user mmiklavc commented on a diff in the pull request:
https://github.com/apache/metron/pull/1250#discussion_r230212895
--- 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 --
More specifically, shouldn't this be isolated to the stellar function
itself? This seems like a bleeding of concerns. With zookeeper, it makes sense
to me because we're taking the architectural position that enabling dynamic,
real-time configuration loading is part of the framework. I don't think that
same general applicability applies to HttpClients. What about using the
initialize method instead?
```
public interface StellarFunction {
Object apply(List<Object> args, Context context) throws ParseException;
void initialize(Context context);
boolean isInitialized();
}
```
> 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)