edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julian Feinauer <j.feina...@pragmaticminds.de>
Subject Re: How to connect Apache Edgent instances via HTTP?
Date Sat, 22 Sep 2018 08:19:58 GMT
Hi Tom,

first of, I'm no real expert for Edgent.
But my first question is, why do you need the HTTP Transport?
Edgent provides many transport layers that work out of the box and I'm a bit unsure about

For your direct question, sending should be fairly easy with libraries like Apaches HTTP Client
But on the receiving side it should be a bit more different as you would need a HTTP Server
Listening, e.g., based on a Custom Servlet in Jetty or something.

Perhaps, if you give some more background on your use case I can try to help you a bit more.


Am 20.09.18, 21:55 schrieb "Tom G." <tom.gelbling@googlemail.com.INVALID>:

    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,

View raw message