Oh dammit ... sorry not for responding to your email Tom (

Guess I was distracted by our PLC4X meetup.

Well I would like to agree with Julian: I doubt raw http is ideal for 
inter-edgent-instance-communication.
The problem is that adding a http client could take care of the one side, 
however you would need a server part on the other side.
So you would have to implement both sides and handle all the marshaling and 
unmarshaling. I would strongly suggest to use a different transport.
Currently I know that the Kafka integration as well as MQTT. But both require 
maintaining a third system.

I guess we never really had "directly linking two Edgent nodes" on our plan ... 
might be a good thing to support ... let me thing about the options ...

Chris




Am 22.09.18, 04:20 schrieb "Julian Feinauer" <j.feina...@pragmaticminds.de>:

    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 HTTP.
    
    For your direct question, sending should be fairly easy with libraries like 
Apaches HTTP Client (http://hc.apache.org/httpclient-3.x/).
    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.
    
    Best
    Julian
    
    Am 20.09.18, 21:55 schrieb "Tom G." <tom.gelbl...@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
        disk.
        
        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
            lines.print();
        
                //Insert ‘send data to HTTP server’ here
        
                //Submit the topology
                dp.submit(top);
            }
        }
        
        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,
        
        Tom
        
    
    

Reply via email to