-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from ddebrunner/cmd-28
Add scalable application support.
- Loading branch information
Showing
20 changed files
with
465 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
com.ibm.streamsx.iot/com.ibm.streamsx.iot.watson/devicepublish.spl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
# Licensed Materials - Property of IBM | ||
# Copyright IBM Corp. 2016 | ||
*/ | ||
|
||
namespace com.ibm.streamsx.iot.watson; | ||
|
||
use com.ibm.streamsx.iot::*; | ||
use com.ibm.streamsx.topology.topic::Publish; | ||
|
||
/** | ||
* Publishes all device statuses for an organization. | ||
* | ||
* Publishes to the topic `streamsx/iot/device/statuses` | ||
* with a tuple type of [DeviceStatus]. | ||
* | ||
* @param org Organization identifier. | ||
* @param authKey Application key. | ||
* @param authToken Application authorization token. | ||
* @param encrypted True to use encrypted connections to IBM Watson IoT Platform, false to use unencrypted , defaults to `true`. | ||
* @param allowFilter True to use allow subscribers to push tuple filtering to this composite, defaults to `true`. | ||
* | ||
*/ | ||
public composite PublishDeviceStatuses() { | ||
param | ||
expression<rstring> $org; | ||
expression<rstring> $authKey; | ||
expression<rstring> $authToken; | ||
expression<boolean> $encrypted : true; | ||
expression<boolean> $allowFilter : true; | ||
|
||
graph | ||
|
||
stream<DeviceStatus> Statuses = DeviceStatuses() { | ||
param | ||
org : $org ; | ||
authKey : $authKey ; | ||
authToken : $authToken ; | ||
encrypted: $encrypted; | ||
} | ||
|
||
() as PublishedStatuses = Publish(Statuses) { | ||
param topic: "streamsx/iot/device/statuses"; | ||
allowFilter: $allowFilter; | ||
} | ||
} | ||
|
||
/** | ||
* Publishes all device events for an organization. | ||
* | ||
* Publishes to the topic `streamsx/iot/device/events` | ||
* with a tuple type of [DeviceEvent]. | ||
* | ||
* @param org Organization identifier. | ||
* @param authKey Application key. | ||
* @param authToken Application authorization token. | ||
* @param encrypted True to use encrypted connections to IBM Watson IoT Platform, false to use unencrypted , defaults to `true`. | ||
* @param allowFilter True to use allow subscribers to push tuple filtering to this composite, defaults to `true`. | ||
* | ||
*/ | ||
public composite PublishDeviceEvents() { | ||
param | ||
expression<rstring> $org; | ||
expression<rstring> $authKey; | ||
expression<rstring> $authToken; | ||
expression<boolean> $encrypted : true; | ||
expression<boolean> $allowFilter : true; | ||
|
||
graph | ||
|
||
stream<DeviceEvent> Events = DeviceEvents() | ||
{ | ||
param | ||
org : $org ; | ||
authKey : $authKey ; | ||
authToken : $authToken ; | ||
encrypted: $encrypted; | ||
} | ||
() as PublishedEvents = Publish(Events) { | ||
param topic: "streamsx/iot/device/events"; | ||
allowFilter: $allowFilter; | ||
} | ||
} | ||
|
||
/** | ||
* Publishes all device commands for an organization. | ||
* | ||
* Publishes to the topic `streamsx/iot/device/commands/sent` | ||
* with a tuple type of [DeviceCmd]. | ||
* | ||
* @param org Organization identifier. | ||
* @param authKey Application key. | ||
* @param authToken Application authorization token. | ||
* @param encrypted True to use encrypted connections to IBM Watson IoT Platform, false to use unencrypted , defaults to `true`. | ||
* @param allowFilter True to use allow subscribers to push tuple filtering to this composite, defaults to `true`. | ||
* | ||
*/ | ||
public composite PublishDeviceCommands() { | ||
param | ||
expression<rstring> $org; | ||
expression<rstring> $authKey; | ||
expression<rstring> $authToken; | ||
expression<boolean> $encrypted : true; | ||
expression<boolean> $allowFilter : true; | ||
|
||
graph | ||
stream<DeviceCmd> Commands = DeviceCommands() | ||
{ | ||
param | ||
org : $org ; | ||
authKey : $authKey ; | ||
authToken : $authToken ; | ||
encrypted: $encrypted; | ||
} | ||
|
||
() as PublishedCommands = Publish(Commands) { | ||
param topic: "streamsx/iot/device/commands/sent"; | ||
allowFilter: $allowFilter; | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
com.ibm.streamsx.iot/com.ibm.streamsx.iot.watson/devicesubscribe.spl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
# Licensed Materials - Property of IBM | ||
# Copyright IBM Corp. 2016 | ||
*/ | ||
|
||
namespace com.ibm.streamsx.iot.watson; | ||
|
||
use com.ibm.streamsx.iot::*; | ||
use com.ibm.streamsx.topology.topic::Subscribe; | ||
|
||
/** | ||
* Subsribes to device commands to be sent to devices for an organization. | ||
* | ||
* Subscribes to the topic `streamsx/iot/device/commands/send` | ||
* with a tuple type of [DeviceCmd]. | ||
* | ||
* @param org Organization identifier. | ||
* @param authKey Application key. | ||
* @param authToken Application authorization token. | ||
* @param encrypted True to use encrypted connections to IBM Watson IoT Platform, false to use unencrypted , defaults to `true`. | ||
* | ||
*/ | ||
public composite SubscribeDeviceCommands() { | ||
param | ||
expression<rstring> $org; | ||
expression<rstring> $authKey; | ||
expression<rstring> $authToken; | ||
expression<boolean> $encrypted : true; | ||
|
||
graph | ||
stream<DeviceCmd> CommandsToSend = Subscribe() { | ||
param | ||
topic: "streamsx/iot/device/commands/send"; | ||
streamType: DeviceCmd; | ||
} | ||
() as SendCommandsToDevice = SendCommandToDevice(CommandsToSend) { | ||
param | ||
org : $org; | ||
authKey : $authKey; | ||
authToken : $authToken; | ||
encrypted : $encrypted; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.