Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 609D3200CA7 for ; Wed, 31 May 2017 05:12:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5F2D2160BDC; Wed, 31 May 2017 03:12:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A5A81160BC9 for ; Wed, 31 May 2017 05:12:30 +0200 (CEST) Received: (qmail 77932 invoked by uid 500); 31 May 2017 03:12:29 -0000 Mailing-List: contact dev-help@edgent.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@edgent.apache.org Delivered-To: mailing list dev@edgent.apache.org Received: (qmail 77916 invoked by uid 99); 31 May 2017 03:12:29 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 May 2017 03:12:29 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id C4A651A0427 for ; Wed, 31 May 2017 03:12:28 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.401 X-Spam-Level: X-Spam-Status: No, score=-0.401 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.8, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id GdT8MDqxG2m2 for ; Wed, 31 May 2017 03:12:27 +0000 (UTC) Received: from mail-qk0-f171.google.com (mail-qk0-f171.google.com [209.85.220.171]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 3C3FA5F3BF for ; Wed, 31 May 2017 03:12:27 +0000 (UTC) Received: by mail-qk0-f171.google.com with SMTP id 19so2525022qke.2 for ; Tue, 30 May 2017 20:12:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=o6YNRgLqjY9I7zQY6848vYkkF7SAAC+5mYNP8PDONfY=; b=MoVcGBEhv6KEk99MUqL5MlxwMpNzbPydpOj00Rpc6VSnMymwcm4BPuKw/3YYnJccX/ 0ZjCUg0Exwniv66pONbhovmR8ln07TVObU6g4km5/PLhcuiOE0Jm5oTNHBqMCZ7+cCKQ qURqEeqrPxGIUmqCBk2CdDvDEwCOA4LVd3+anozvN19+PI+VFLmrUS5vrnwMCbz5iQRl QZKVqvZLqaO0gaa8Vtunyny2P9nyyHmtMdO5aWh4KibpG/EndAUZFGzEL6imzMvQTWG4 OPf77WvvglxVV5UWRPF5NiPPPBfyiBRETJ5ePVKNNfB1bdYZPYKINhxgeWU6yWMA+cYs SQ7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=o6YNRgLqjY9I7zQY6848vYkkF7SAAC+5mYNP8PDONfY=; b=TpAaxbUL7vZ+Tr3Ivg1mfW7uWgw6W6Fcet0wYie40qoZbpkGsVvmTNMJ/1aWcdspqX 7/XhP0wNoN+o9sfO95H/xOONzivly3/t5qs+bMjQ51YD7iMBH7Lucj8KTBEOF7G+AyzZ 880twY/xCMbV9zjg/tPtlrKsk8zrv2HeNlX5U3OO69JPFjttT6c8CGQRfoilQZ7WQqnG vyLYJq9htEkFRLzlG4KGUsKcwqP0184cbEMaBoubDTwSLg0PY6COSFDoRW0TUZfZMrd+ LhZCx37I6ylgBQvEjx0TdTzKrd+y5xkkRNjyCGKUYUN7KNJMZGX2wYPabr2EmZihnhaX rEDg== X-Gm-Message-State: AODbwcAZosv7oyp1mWz663H8Enu3+ZYfBmy2m4tmnMUG+tiyroe7nqxk BdC7nyc2L9nawWkM3OJ1QbYEzWIFIwktGWY= X-Received: by 10.55.75.7 with SMTP id y7mr25081564qka.2.1496200346702; Tue, 30 May 2017 20:12:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.89.149 with HTTP; Tue, 30 May 2017 20:11:46 -0700 (PDT) From: Gayashan Amarasinghe Date: Wed, 31 May 2017 13:11:46 +1000 Message-ID: Subject: Looking for samples and some help on Loosely coupled Edgent applications To: dev@edgent.apache.org Content-Type: multipart/alternative; boundary="001a114a8d5a2d98d70550c94a71" archived-at: Wed, 31 May 2017 03:12:31 -0000 --001a114a8d5a2d98d70550c94a71 Content-Type: text/plain; charset="UTF-8" Hi Edgent community, I am a PhD student from University of Melbourne and I am interested in the Apache Edgent project. I need some help to implement a scenario to submit a topology externally to a provider. Unfortunately apart from some test cases in the source code and [1], I couldn't find any documentation on this. So here's what I have done so far, - I have implemented the TopologyBuilder interface and created a separate jar. This is the code in the class. public class MyTopology implements TopologyBuilder { @Override public String getName() { return "MyCPUTempApp"; } @Override public BiConsumer getBuilder() { CPUTempSensor cpuTempSensor = new CPUTempSensor(); return (t, c) -> t.poll(cpuTempSensor, 2, TimeUnit.SECONDS) .filter(readings -> readings > 35).sink(System.out::println); } } - In a separate project, I have created another class to instantiate a DirectProvider and to load the previous jar using an AppService similar to the IotAppServiceTest. Here's the code, public class DynamicAppLoader { public static void main(String[] args) { DirectProvider directProvider = new DirectProvider(); JsonControlService jsonControlService = new JsonControlService(); directProvider.getServices().addService(ControlService.class, jsonControlService); ApplicationService service = AppService.createAndRegister(directProvider, directProvider); File cpuTempAppJar = new File("/home/gayashan/projects/research/cputemptopology/target/cputemptopology-1.0.0.jar"); try { URL cpuTempAppJarUrl = cpuTempAppJar.toURI().toURL(); JsonObject registerJar = newRegisterJarRequest(cpuTempAppJarUrl.toExternalForm()); jsonControlService.controlRequest(registerJar); JsonObject submitCpuTempApp = newSubmitRequest("MyCPUTempApp"); jsonControlService.controlRequest(submitCpuTempApp); System.out.println(service.getApplicationNames()); } catch (Exception e) { System.err.println("Error: " + e.getLocalizedMessage()); } } ... // newRegisterJarRequest and newSubmitRequest methods are as same as in the IotAppServiceTest class. } But unfortunately I don't understand how to get this to work. Can someone help me with this and point where I am making a mistake? Apologies in advance if this seems like a trivial question. Thank you. [1] https://edgent.apache.org/recipes/recipe_dynamic_analytic_control.html#loosely-coupled-edgent-applications Best regards, Gayashan --001a114a8d5a2d98d70550c94a71--