简体   繁体   English

将流从 java 发送到 apache nifi 处理器

[英]Send flow from java to apache nifi processor

Good Morning everyone So I have this java code that parses into swagger documentation file (a JSON file) and split its:大家早上好所以我有这个 java 代码,它解析成 swagger 文档文件(一个 JSON 文件)并将其拆分:

{ Swagger swagger = new SwaggerParser().read("C:/Users/admin/Desktop/testdownload.txt");
  Map<String, Path> paths = swagger.getPaths();
  for (Map.Entry<String, Path> p : paths.entrySet()) {
    Path path = p.getValue();
    Map<HttpMethod, Operation> operations = path.getOperationMap();
    for (java.util.Map.Entry<HttpMethod, Operation> o : operations.entrySet()) {
      System.out.println("===");
      System.out.println("PATH:" + p.getKey());
      System.out.println("Http method:" + o.getKey());
      System.out.println("Summary:" + o.getValue().getSummary());
      System.out.println("Parameters number: " + o.getValue().getParameters().size());
      for (Parameter parameter : o.getValue().getParameters()) {
        System.out.println(" - " + parameter.getName());
      }
      System.out.println("Responses:");
      for (Map.Entry<String, Response> r : o.getValue().getResponses().entrySet()) {
        System.out.println(" - " + r.getKey() + ": " + r.getValue().getDescription());
      }
      System.out.println("");
    }

  }
}

And here is the input:这是输入: 输入文件 and the output is :输出是: 输出文件

What I want to ask is: is it possible to send this output one path by one to apache Nifi ??我想问的是:是否可以将此输出一条一条路径发送到 apache Nifi ? is there is any solution that Nifi extracts those outputs and put each one of them in a dependent processor??有没有什么解决方案可以让 Nifi 提取这些输出并将它们中的每一个都放在一个从属处理器中?

You could start a HTTP lister service in NiFi.您可以在 NiFi 中启动 HTTP 列表服务。 Use the HandleHttpRequest使用HandleHttpRequest

Some time ago I did something like this.前段时间我做了这样的事情。 And was sending data from my Java application to this HandleHttpRequest.并将数据从我的 Java 应用程序发送到此 HandleHttpRequest。 This Processor is designed to be used in conjunction with the HandleHttpResponse Processor in order to create a Web Service此处理器旨在与 HandleHttpResponse 处理器结合使用以创建 Web 服务

You just have to post your data to this webservice and the webservice can consume it and you would already have your data in NiFi.您只需将数据发布到此网络服务,网络服务就可以使用它,并且您已经将数据保存在 NiFi 中。 From then on, you are manipulate and control you data as you please.从那时起,您可以随心所欲地操纵和控制您的数据。

在此处输入图片说明

You can also look into ListenHTTP您还可以查看ListenHTTP

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM