Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the console 1 download the agent. (NOTE: Update the version (1.8.2) to the latest in the URL )

Code Block
languagebash
themeRDark
titleDeployment (console 1)
wgetcurl -O "https://nexus.linksmart.eu/reporepository/servicemaven-releases/localeu/artifactlinksmart/maven/content?r=releases&g=eu.linksmart.services.events.gpl.distributions&a=services/events/gpl/distributions/iot.learning.universal.gpl.agent/1.8.2/iot.learning.universal.agent&v=LATEST" -O agent.jargpl.agent-1.8.2.jar"
Code Block
languagebash
themeDJango
titleResult Deployment (console 1)
--2017-10-26 13:24:26--  https://linksmart.eu/repo/service/local/artifact/maven/content?r=releases&g=eu.linksmart.services.events.gpl.distributions&a=iot.learning.universal.agent&v=LATEST
Resolving linksmart.eu (linksmart.eu)... 52.59.168.195, 52.59.86.181
Connecting to linksmart.eu (linksmart.eu)|52.59.168.195|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 177127313 (169M) [application/java-archive]
Saving to: ‘agent.jar’

100%[===========================================================================================================================================================================================================>] 177,127,313 3.44MB/s   in 2m 30s

2017-10-26 13:26:56 (1.13 MB/s) - ‘agent.jar’ saved [177127313/177127313]% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49.1M  100 49.1M    0     0  6935k      0  0:00:07  0:00:07 --:--:-- 6938k

Again in console 1, we started the agent. 

Code Block
languagebash
themeRDark
titleRun (console 1)
export# using bash
env_var_enabled=true export cep_init_engines=eu.linksmart.services.event.cep.engines.EsperEngine export agent_init_extensions=eu.linksmart.services.event.ceml.core.CEML java -jar agent.jar cp ./* "org.springframework.boot.loader.PropertiesLauncher"

# using powershell
$env:env_var_enabled="true"
$env:cep_init_engines="eu.linksmart.services.event.cep.engines.EsperEngine"
$env:agent_init_extensions="eu.linksmart.services.event.ceml.core.CEML"
java -cp .\*  "org.springframework.boot.loader.PropertiesLauncher"
Code Block
languagebash
themeDJango
titleResult Run (console 1)
....
Lot of the output had being remove. 
If no exception is given then this output is not relevant now. 
....
2016-09-08 16:00:16.202  INFO 16010 --- [           main] eu.linksmart.services.Application        : Started Application in 6.607 seconds (JVM running for 9.535)

...

Code Block
languagepy
themeDJango
titlePrettify Result (console 2)
collapsetrue
{ 	 
   "resources": { 		"d88809505168bb760859e4651c15008d9d0a4435c9b9419555716dab3a78ecf1 
      "6de4cb5b60053d24967379da038c946bdc4947437cfd56571b24163e68a64d33": { 			 
         "cehandler": "eu.linksmart.services.event.handler.ComplexEventHandler",
			"registrable": true,
			"restoutput": false,
			"name": "countEvents",
			"statement":          "restoutput":false,
         "persistent":false,
         "essential":false,
         "id":"6de4cb5b60053d24967379da038c946bdc4947437cfd56571b24163e68a64d33",
         "name":"countEvents",
         "statement":"select count(*) as obs from Observation.win:time(1 sec)",
			"source": "", 			"input": [""], 			"CEHandler": "eu.linksmart.services.event.handler.ComplexEventHandler", 			"StateLifecycle": "RUN",
			"scope  "output": ["outgoing"], 			"TargetAgents": [],
			"ID": "d88809505168bb760859e4651c15008d9d0a4435c9b9419555716dab3a78ecf1", 			"isRestOutput": false, 			"lastOutput": { 				"@iot.id": "397fface-94c6-48b0-8dbb-198c042849d0",
				"featureOfInterest": {
					"@iot.id": "9e8f9be9b26237df0cbaf374a274e12233fbee6e7f690fe775503194dcc54181",
					"description": "BootstrapMessage",
					"observations": [{}, {}
					],
					"@iot.selfLink": "http://linksmart.eu/v1.0/FeatureOfInterest(9e8f9be9b26237df0cbaf374a274e12233fbee6e7f690fe775503194dcc54181)",
					"Observations@iot.navigationLink": "FeatureOfInterest(9e8f9be9b26237df0cbaf374a274e12233fbee6e7f690fe775503194dcc54181)/Observations"
				},
				"datastream": {
					"@iot.id": "e0e0c70e-2df4-4bbc-baee-df463bdb892d",
					"observations": [{}
					],
					"sensor": {
						"@iot.id": "e0e0c70e-2df4-4bbc-baee-df463bdb892d",
						"datastreams": [{}
						],
						"@iot.selfLink": "http://linksmart.eu/v1.0/Sensor(e0e0c70e-2df4-4bbc-baee-df463bdb892d)",
						"Datastreams@iot.navigationLink": "Sensor(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/Datastreams"
					},
					"thing": {
						"@iot.id": "e0e0c70e-2df4-4bbc-baee-df463bdb892d",
						"datastreams": [{}
						],
						"@iot.selfLink": "http://linksmart.eu/v1.0/Thing(e0e0c70e-2df4-4bbc-baee-df463bdb892d)",
						"Datastreams@iot.navigationLink": "Thing(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/Datastreams",
						"HistoricalLocations@iot.navigationLink": "Thing(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/HistoricalLocations",
						"Locations@iot.navigationLink": "Thing(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/Locations"
					},
					"@iot.selfLink": "http://linksmart.eu/v1.0/Datastream(e0e0c70e-2df4-4bbc-baee-df463bdb892d)",
					"Observations@iot.navigationLink": "Datastream(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/Observations",
					"Sensor@iot.navigationLink": "Datastream(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/Sensor",
					"ObservedProperty@iot.navigationLink": "Datastream(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/ObservedProperty",
					"Thing@iot.navigationLink": "Datastream(e0e0c70e-2df4-4bbc-baee-df463bdb892d)/Thing"
				},
				"phenomenonTime": "2017-10-26T11:30:57.300+0000",
				"result": "NaN",
				"@iot.selfLink": "http://linksmart.eu/v1.0/Observation(397fface-94c6-48b0-8dbb-198c042849d0)",
				"FeatureOfInterest@iot.navigationLink": "Observation(397fface-94c6-48b0-8dbb-198c042849d0)/FeatureOfInterest",
				"Datastream@iot.navigationL* Connection #0 to host localhost left intactink": "Observation(397fface-94c6-48b0-8dbb-198c042849d0)/Datastream"
			}
		}
	},
	"responses": [{
			"headline": "Created",
			"agentID": "e0e0c70e-2df4-4bbc-baee-df463bdb892d",
			"producerID": "EsperEngine",
			"producerName": "CEPEngine",
			"message": "Statement d88809505168bb760859e4651c15008d9d0a4435c9b9419555716dab3a78ecf1 was successful",
			"status": 201,
			"messageType": "SUCCESS",
			"topic": "LS/LA/e0e0c70e-2df4-4bbc-baee-df463bdb892d      "LS/LA/bdb51cc6-acb6-4fc5-a1b3-593d4c36e41a/OGC/1.0/Datastreams/6de4cb5b60053d24967379da038c946bdc4947437cfd56571b24163e68a64d33"
         ],
         "stateLifecycle":"RUN",
         "scope":[  
            "outgoing"
         ],
         "agentID":"bdb51cc6-acb6-4fc5-a1b3-593d4c36e41a",
         "resultType":"eu.linksmart.services.payloads.ogc.sensorthing.linked.ObservationImpl",
         "publisher":"MQTT_PUB",
         "registrable":true,
         "logEventEvery":1,
         "discardDataOnFailPolicyOn":false
      }
   },
   "responses":[  
      {  
         "headline":"Created",
         "agentID":"bdb51cc6-acb6-4fc5-a1b3-593d4c36e41a",
         "producerID":"EsperEngine",
         "producerName":"CEPEngine",
         "message":"Statement 6de4cb5b60053d24967379da038c946bdc4947437cfd56571b24163e68a64d33 was successful* Connection #0 to host localhost left intact                                                                                                                                             ",
         "status":201,
         "messageType":"SUCCESS",
         "topics":[  
            "LS/LA/bdb51cc6-acb6-4fc5-a1b3-593d4c36e41a/OGC/1.0/Datastreams/d88809505168bb760859e4651c15008d9d0a4435c9b9419555716dab3a78ecf1/"
		}
	6de4cb5b60053d24967379da038c946bdc4947437cfd56571b24163e68a64d33"
         ]
      }
   ]
}

3) Subscribe to the statement 

...

The output topic can be configured to see IoT agents configuration.

...

The input topic can be configured to see IoT agents configuration.

...

Code Block
languagebash
themeDJango
titleResult (Console 2)
{  
"@iot.id": "40c86297-2421-4e54-9a2e-5fef2f300e6e",   "featureOfInterest": {
    "@iot.id": "6c35493a2b937829c9815c39e23af964bc84e5430a7dc104c700bbc0de2b59e3",
    "description": "count(*)",
    "observations": [{}, {}],
    "@iot.selfLink": "http://linksmart.eu/v1.0/FeatureOfInterest(6c35493a2b937829c9815c39e23af964bc84e5430a7dc104c700bbc0de2b59e3)",
    "Observations@iot.navigationLink": "FeatureOfInterest(6c35493a2b937829c9815c39e23af964bc84e5430a7dc104c700bbc0de2b59e3)/Observations"
  },
  "datastream": {  
  "@iot.id": "276f2948-c252-491b-9b93-8268383fdd92",     "observations": [{}],
    "sensor": {
      "@iot.id": "276f2948-c252-491b-9b93-8268383fdd92","6de4cb5b60053d24967379da038c946bdc4947437cfd56571b24163e68a64d33"
      "datastreams": [{}],
      "@iot.selfLink": "http://linksmart.eu/v1.0/Sensor(276f2948-c252-491b-9b93-8268383fdd92)",
      "Datastreams@iot.navigationLink": "Sensor(276f2948-c252-491b-9b93-8268383fdd92)/Datastreams"
    },
    "thing": {
      "@iot.id": "276f2948-c252-491b-9b93-8268383fdd92",
      "datastreams": [{}],
      "@iot.selfLink": "http://linksmart.eu/v1.0/Thing(276f2948-c252-491b-9b93-8268383fdd92)",
      "Datastreams@iot.navigationLink": "Thing(276f2948-c252-491b-9b93-8268383fdd92)/Datastreams",
      "HistoricalLocations@iot.navigationLink": "Thing(276f2948-c252-491b-9b93-8268383fdd92)/HistoricalLocations",
      "Locations@iot.navigationLink": "Thing(276f2948-c252-491b-9b93-8268383fdd92)/Locations"
    },
    "@iot.selfLink": "http://linksmart.eu/v1.0/Datastream(276f2948-c252-491b-9b93-8268383fdd92)",
    "Observations@iot.navigationLink": "Datastream(276f2948-c252-491b-9b93-8268383fdd92)/Observations",
    "Sensor@iot.navigationLink": "Datastream(276f2948-c252-491b-9b93-8268383fdd92)/Sensor",
    "ObservedProperty@iot.navigationLink": "Datastream(276f2948-c252-491b-9b93-8268383fdd92)/ObservedProperty",
    "Thing@iot.navigationLink": "Datastream(276f2948-c252-491b-9b93-8268383fdd92)/Thing"
  },
  "phenomenonTime": "20172019-0809-17T1606T10:1732:35.919+0000845Z",
   "result": 120,
  "@iot.selfLink": "http://linksmart.eu/v1.0/Observation(40c86297-2421-4e54-9a2e-5fef2f300e6e)",
  "FeatureOfInterest@iot.navigationLink": "Observation(40c86297-2421-4e54-9a2e-5fef2f300e6e)/FeatureOfInterest",
  "Datastream@iot.navigationLink": "Observation(40c86297-2421-4e54-9a2e-5fef2f300e6e)/Datastream"
1
}