edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom G." <tom.gelbl...@googlemail.com.INVALID>
Subject How to connect Apache Edgent instances via HTTP?
Date Thu, 20 Sep 2018 19:00:01 GMT
Dear Apache Edgent community,

I’m trying to figure out how to establish a HTTP connection between two
Apache Edgent instances.
I want to tail an active file and send the appended records via HTTP to
another Apache Edgent instance.
The second instance should receive these records via HTTP and write them to

My code for the first instance looks like this:

package com.mycompany.app;

import org.apache.edgent.connectors.http.*;
import org.apache.edgent.connectors.file.*;
import org.apache.edgent.providers.direct.DirectProvider;
import org.apache.edgent.topology.TStream;
import org.apache.edgent.topology.Topology;

 * Edgent Application template.

public class TemplateApp {

    public static void main(String[] args) throws Exception {

         //Create a provider
        DirectProvider dp = new DirectProvider();

        //Create a topology
        Topology top = dp.newTopology();

        //Build the topology
        String watchedDir = "/tmp/test/";

        //Read file
        TStream<String> pathnames = FileStreams.directoryWatcher(top, () ->
watchedDir, null);
        TStream<String> lines = FileStreams.textFileReader(pathnames);

        //Insert filter here

        //Insert ‘send data to HTTP server’ here

        //Submit the topology

How do I fill the gap after “//Insert ‘send data to HTTP server’ here” to
be able to send the records to the second instance?

How does the HTTP part of the second instance have to look like to be able
to receive these records?

Best regards,


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message