edgent-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dale LaBossiere <dml.apa...@gmail.com>
Subject Re: Trying register an application via the registerJar command
Date Mon, 19 Sep 2016 15:07:54 GMT
The TopologyBuilder.getBuilder() impl is bogus.  Looks like it’s copied from TestApplication().
 All it does is return a builder (BiConsumer) that creates a topology consisting of a TStream<String>
containing one tuple with the app’s name and prints that stream.

Your getBuilder() impl needs to return a BiConsumer that builds your app’s topology.  Looks
like that’s what your accept() is trying to do.  Seems like you want something like (though
I’d rename that accept() to something like “buildTopology()” for clarity).

       public BiConsumer<Topology, JsonObject> getBuilder() {
       		return (t,c) -> accept(t,c);
       }   

Fix that and then see what happens regarding handling of the submit request.  You might also
consider adding a println to your getBuilder() and accept() to verify they’re getting called.

— Dale

> On Sep 16, 2016, at 5:44 PM, Susan Cline <home4slc@pacbell.net> wrote:
> 
> Thanks Dale.  It did not work however, the results are the same after removing the 3
lines before provider.start().
> When I submit the SpeedJarApp I can see this in the pi terminal (this is the full output
from when I started the registerJarExample application to when I submitted the command):
> 
> pi@raspberrypi:~/devConf $ java -jar registerJarExample.jar speed_sensor_config1.txt
> Sep 16, 2016 9:39:08 PM org.apache.edgent.runtime.appservice.AppService registerTopology
> INFO: Register application name: edgentIotDevicePubSub
> Sep 16, 2016 9:39:08 PM org.apache.edgent.runtime.appservice.AppService registerTopology
> INFO: Register application name: edgentIotCommandsToControl
> Sep 16, 2016 9:39:08 PM org.apache.edgent.runtime.appservice.AppService registerTopology
> INFO: Register application name: edgentJobMonitorApp
> false
> Sep 16, 2016 9:39:09 PM pi.RegisterJarExample main
> INFO: Here is some info
> Sep 16, 2016 9:39:09 PM com.ibm.iotf.client.AbstractClient createClient
> INFO: pool-1-thread-22-edgentIotDevicePubSub: Org ID    = ni6dcf
>         Client ID    = d:ni6dcf:SpeedSensor:Pi3_SpeedSensor_1
> Sep 16, 2016 9:39:09 PM com.ibm.iotf.client.AbstractClient connect
> INFO: pool-1-thread-22-edgentIotDevicePubSub: Connecting client d:ni6dcf:SpeedSensor:Pi3_SpeedSensor_1
to ssl://ni6dcf.messaging.internetofthings.ibmcloud.com:8883 (attempt #1)...
> Sep 16, 2016 9:39:10 PM com.ibm.iotf.client.AbstractClient connect
> INFO: pool-1-thread-22-edgentIotDevicePubSub: Successfully connected to the IBM Watson
IoT Platform
> Sep 16, 2016 9:39:49 PM org.apache.edgent.runtime.appservice.AppService registerJar
> INFO: Register jar: file:///home/pi/devConf/pi.sensors.jar
> Sep 16, 2016 9:39:49 PM org.apache.edgent.runtime.appservice.AppService registerJar
> INFO: about to call registerTopology
> Sep 16, 2016 9:39:49 PM org.apache.edgent.runtime.appservice.AppService registerTopology
> INFO: Register application name: SpeedJarApp
> SpeedJarApp
> Sep 16, 2016 9:40:11 PM org.apache.edgent.runtime.etiao.Executable$1 accept
> INFO: No more active user tasks
> 
> Thanks,
> 
> Susan
> 
> 
> 
>> On Sep 16, 2016, at 10:32 AM, Dale LaBossiere <dml.apache@gmail.com> wrote:
>> 
>> I haven’t digested the complete email message yet, but try removing those three
lines before provider.start() and try again.
>> IotProvider already create/registers those services (described in its javadoc). 
I guess I wouldn’t be surprised if these extra additions might much things up.
>> 
>> — Dale
>> 
>>> On Sep 16, 2016, at 1:17 PM, Susan Cline <home4slc@pacbell.net> wrote:
>>> 
>>> I’ve gotten a step further, but I am still having problems.
>>> ...
>>> 
>>> public class RegisterJarExample {
>>> 		IotProvider provider = new IotProvider(topology -> new IotpDevice(topology,
configFile));
>>> 		/*
>>> 		 * Not sure if I need the next few lines or not ...
>>> 		 */
>>> 		JsonControlService control = new JsonControlService();
>>> 		provider.getServices().addService(ControlService.class, control); 
>>> 		ApplicationService appService = AppService.createAndRegister(provider, provider);
>>> 		provider.start();
>>> 		
>>> 		logger.info("Here is some info");
>>> 	}
>>> 	
>>> }
>> 
> 


Mime
View raw message