User Tools

Site Tools


sensorweaver:developer-guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
sensorweaver:developer-guide [2015-11-10 16:33] – [Getting an instance of the Middleware service] luigi.fortunatisensorweaver:developer-guide [2015-11-10 16:46] (current) – [Testing your app] luigi.fortunati
Line 243: Line 243:
  builder.property("sensorType", "temperatureSensor");  builder.property("sensorType", "temperatureSensor");
  builder.parameter("temperature", new Property("Unit of Measure","Celsius"));  builder.parameter("temperature", new Property("Unit of Measure","Celsius"));
- builder.parameter("timestamp", new Property("Format","ISO8601")); + return builder.build();
- DataFeedDescriptor descriptor = builder.build()+
- return descriptor;+
 } }
 </code> </code>
Line 271: Line 269:
  MessageBuilder messageBuilder = dataFeedClient.buildMessage();  MessageBuilder messageBuilder = dataFeedClient.buildMessage();
  messageBuilder.entry("temperature", Integer.toString(datasource.getValue()));  messageBuilder.entry("temperature", Integer.toString(datasource.getValue()));
- messageBuilder.entry("timestamp", DateTime.now().toString());+ messageBuilder.timestamp(Calendar.getInstance().getTimeInMillis());
  messageBuilder.send();  messageBuilder.send();
 } }
Line 277: Line 275:
  
 In order to publish a message for a given //data feed// you must produce values for all of the message elements defined previously in the //data feed descriptor//. In order to publish a message for a given //data feed// you must produce values for all of the message elements defined previously in the //data feed descriptor//.
 +
 +The datafeed client includes a method //timestamp// for setting the timestamp of the message. If not used, the middleware will set the timestamp at the time of the invocation of the send method.
  
 === Unregistering a Data Feed === === Unregistering a Data Feed ===
Line 350: Line 350:
 Applications can be easily tested in the [[http://karaf.apache.org/|Karaf]] OSGi environment, using provided logging and debugging tools. Applications can be easily tested in the [[http://karaf.apache.org/|Karaf]] OSGi environment, using provided logging and debugging tools.
  
-SensorWeaver provides a preconfigured {{:sensorweaver:sensorweaver-karaf-bundle.tar.gz|Apache Karaf Bundle}} that you can use for development purposes. +You can download your preferred Apache Karaf release (latest version is strongly recommended) and install the ''middleware'' feature from the latest [[http://ala.isti.cnr.it:8081/nexus/index.html#nexus-search;quick~sensorweaver-features|SensorWeaver karaf feature repository]] to start up your container.
-Alternatively you can download your preferred Apache Karaf release and use the ''middleware-dev'' feature from the [[http://ala.isti.cnr.it:8081/nexus/service/local/repositories/wnlab-releases/content/it/cnr/isti/sensorweaver/sensorweaver-features/2.0.0/sensorweaver-features-2.0.0-features.xml|SensorWeaver karaf feature repository]] to start up your container.+
  
-Configuration coming with both solutions assume that you have an MQTT broker online on port 1883 on your local machine.+Deafult feature configuration assumes that you have an MQTT broker online on port 1883 on your local machine.
  
 Please refer to the [[sensorweaver:admin-guide|Administrator Guide]] in order to setup and configure your OSGI environment. Please refer to the [[sensorweaver:admin-guide|Administrator Guide]] in order to setup and configure your OSGI environment.
sensorweaver/developer-guide.1447173186.txt.gz · Last modified: 2015-11-10 16:33 by luigi.fortunati

Donate Powered by PHP Valid HTML5 Valid CSS Run on Debian Driven by DokuWiki