Send flow from java to apache nifi processor

maryem neyli :

Good Morning everyone So I have this java code that parses into swagger documentation file (a JSON file) and split its:

{ 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: input file and the output is : output file

What I want to ask is: is it possible to send this output one path by one to apache Nifi ?? is there is any solution that Nifi extracts those outputs and put each one of them in a dependent processor??

WinnieDaPooh :

You could start a HTTP lister service in NiFi. Use the HandleHttpRequest

Some time ago I did something like this. And was sending data from my Java application to this HandleHttpRequest. This Processor is designed to be used in conjunction with the HandleHttpResponse Processor in order to create a Web Service

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. From then on, you are manipulate and control you data as you please.

enter image description here

You can also look into ListenHTTP

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=26914&siteId=1
Recommended