...
A Facet Type is a unit of capability (or method) represented by a piece of executable code (a Java class) intended to process a request. The facet type’s method selection is based on the facet lifecycle event model. In short, the TQLEngine A-Stack invokes the appropriate facet type method using the current facet pipeline connection context and facet instance information as argument.
Facet Types in the TQLEngineA-Stack
Name | Type Name | Description |
---|
Message | SffMsgFacet | Generic Message Communication. |
Network | SffNetworkFacet |
TQLEngine A-Stack cluster support. Define the list of |
TQLEngineA-Stack(s) that can participate in syncing their data |
TQLTql | SffTqlFacet | Thing Query Language Support (Thing Definition, Thing Interaction) |
Workflow | SffWdlFacet | Workflow Language Support |
Behavior Trees | SffBdlFacet | Behavior Tree Implementation |
Topic | SffTopicFacet | Subscription and Notification of Model changes |
Scheduling | SffSequenceFacet | Schedule tasks / jobs (piece of Model code) to be executed in a repeated sequence of defined interval. |
Static Files | SffStaticFileFacet | Serve static files using |
TQLEngineMessage
Message Facet Type is a generic Message processing over any given specified transport. Message Facet Type does not support any specific payload to process unlike other Facet types. Message Facet Type can be used process any payload that is passed to it.
Facet Type Name | SffMsgFacet |
---|
Language Support | FacetScript |
---|
Transports | HttpServerExtensionArgs |
---|
WsServerExtensionArgWsServerExtensionArgs |
Usage | |
---|
using in <NewFacetInstance> when creating a Package (Deployment) definition for your models. |
PeripheralParamsSffMsgFacet Example | linenumbers | true |
---|
| <NewFacetInstance fid="smartparking" name="SmartParking" type="SffMsgFacet">
<OnOpen ModifyPipeline="HttpServerExtensionArgs" />
<OnRequest>
<!-- Handle Request -->
<!-- Any FacetScript Code can go in here... ->
<DoResponse>
<!-- Send the response back.. ->
</ |
|
DoResponse></OnRequest><DoResponse>
</OnRequest>
</NewFacetInstance> |
|
Other Names | SffTcpFacet |
---|
Use |
---|
- Cases | - Publish HTTP or WebSocket Endpoint served by
|
---|
TQLEngine - A-Stack to process any request and send response.
- Can be used to create a proxy to other facet types (like SffTqlFacet).
|
Network
Network Facet Type allows TQL users to specify network definition of their A-Stacks. Network Facet Type is normally used to create a cluster of A-Stacks so that the TQL storage can be shared across those A-Stacks.
Facet Type Name | SffNetworkFacet |
---|
Language Support | Network Definition using <Network> Tag. |
---|
Transports | WsServerExtensionArgs |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Network defintion is created at the time of OnActivate Facet Instance Lifecycle. Code Block |
---|
language | xml |
---|
title | SffNetworkFacet Example |
---|
linenumbers | true |
---|
| <!-- Define Cluster / Network -->
<NewFacetInstance fid="cluster" name="cluster" type="SffNetworkFacet">
<OnActivate>
<Process>
<Network>
<Group name="FarmGatewayGroup" />
<A-Stack name="Cloud0" url="ws://10.0.1.4:8080/fid-cluster"
group="FarmGatewayGroup" replicateTo="FarmCloudGroup"
documentation="Cloud Summary Holder" />
<Group name="FarmCloudGroup" />
<A-Stack name="Cloud1"
url="ws://farm.atomiton.com:8080/fid-cluster" group="FarmCloudGroup"
replicateTo="FarmCloudGroup" documentation="Cloud Summary Holder" />
</Network>
</Process>
</OnActivate>
<OnOpen ModifyPipeline="WsServerExtensionArgs" />
</NewFacetInstance> |
|
---|
Associated within other FacetTypes | Instances of Network Facet Types are normally associated with the TQL Facet types so that the data can be replicated. Association can be done as follows: Code Block |
---|
language | xml |
---|
title | SffNetworkFacet Associated within SffTqlFacet |
---|
linenumbers | true |
---|
| <!-- Cluster specific replication -->
<NewFacetInstance fid="SmartParking" Name="TQL" Type="SffTqlFacet">
<OnActivate>
<!-- Associating Instance of Network facet -->
<NetworkFacet>cluster</NetworkFacet>
</NewFacetInstance> |
|
---|
Use Cases | - Replicate data between different instances of A-Stack.
- Broadcast messages to TQEngine(s)
|
---|
TQL
Message Facet Type is a generic Message processing over any given specified transport. Message Facet Type does not support any specific payload to process unlike other Facet types. Message Facet Type can be used process any payload that is passed to it.
Facet Type Name | SffTqlFacet |
---|
Language Support | Thing Interaction Language (TIL) - TQL CRUD Queries requested via <Query> tag. |
---|
Transports | HttpServerExtensionArgs WsServerExtensionArgs |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Code Block |
---|
language | xml |
---|
title | SffTqlFacet Example |
---|
linenumbers | true |
---|
| <!-- Typical TQL Facet Definition -->
<NewFacetInstance fid="[:RuntimeParams.WSFacetIDName:]Cluster"
Name="TQL" Type="SffTqlFacet">
<OnActivate>
<!-- Associate other facet types; Either Private or Public Instances -->
<NewFacetInstance name="tqlwfws" type="SffWdlFacet" /> <!-- Private Instance of wdl facet -->
<NetworkFacet>?cluster</NetworkFacet> <!-- Public Instance of Network Facet -->
<TopicFacet>?TQLGenericTopic</TopicFacet> <!-- Public Instance of Topic Facet -->
<ImportFacet>[:RuntimeParams.MacroFacetID:]</ImportFacet> <!-- Private Instance of Msg facet -->
<Process>
<!-- Define TQL Storage Scheme -->
<Storage Name="[:RuntimeParams.TQLCacheName:]" Type="SqlSff"
Comment="[:RuntimeParams.TQLCacheName:] Database SFF Unstructured SQL database" />
<!-- Specify the Model Definition file (TDL). Normally consists of Model definitions -->
<Namespace>
<Include>cloud.dbm.xml</Include>
</Namespace>
</Process>
</OnActivate>
<OnOpen ModifyPipeline="WsServerExtensionArgs" />
<OnRequest>
<DoRequest> <!-- HandOff the request to Facet -->
<Process Return="CMD_NOP">
<Message>
<Value>
<Include>$Request.Message.Value</Include>
</Value>
</Message>
</Process>
</DoRequest>
<DoResponse> <!-- Process the response from Facet or send it straight through -->
<Process>
<Message type="[:RuntimeParams.TQLOutputFormat:]">
<Value>
<Include>$Response.Message.Value</Include>
</Value>
</Message>
</Process>
</DoResponse>
</OnRequest>
</NewFacetInstance> |
|
---|
Associating Other Facet Types | TQL Facet normally associates other facet types that are either private or public Instances. Private Instances are those that are defined internal with the TQL Facet Instance definition. |
---|
Use Cases | - Handle TQL Query request from external users over a given transport (Http or WS).
|
---|
Workflow
Workflow facet types allows users to install workflow definitions that can be called from other models.
Facet Type Name | SffWdlFacet |
---|
Language Support | Workflow Definition Language (WDL) |
---|
Transports | HttpServerExtensionArgs WsServerExtensionArg |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Workflows are typically installed at the time of <OnActivate> Life cycle. Note that Workflows are not a request / response style or external transport. Code Block |
---|
language | xml |
---|
title | SffWdlFacet Example |
---|
linenumbers | true |
---|
| <NewFacetInstance fid="[:RuntimeParams.WdlFacetIDName:]" Name="wdl" Type="SffWdlFacet">
<OnActivate>
<Include></Include> <!-- Specify Workflow defintion files -->
</OnActivate>
<OnOpen ModifyPipeline="HttpServerExtensionArgs"/>
</NewFacetInstance> |
|
---|
Associated within other Facet Types | Private instances are associated within TQL Facet Types |
---|
Use Cases | - Implement complex business logic either (Thing or App) using Workflows.
- Private instance of Workflow Facet is a requirement for Thing and App Facets to function correctly as part of Tql Facet types.
|
---|
Behavior Tree
Behavior Tree Facet implements Behavior Trees
Facet Type Name | SffBdlFacet |
---|
Language Support | Behavior Definition Lanauge (BDL) |
---|
Transports | HttpServerExtensionArgs WsServerExtensionArg |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Code Block |
---|
language | xml |
---|
title | SffMsgFacet Example |
---|
linenumbers | true |
---|
| <NewFacetInstance fid="bdl" name="bdl" type="SffBdlFacet">
<OnOpen ModifyPipeline="WsServerExtensionArgs"/>
</NewFacetInstance> |
|
---|
Use Cases | - Implement complex business logic either (Thing or App) using Behavior trees.
|
---|
Topic
Topic Facet implements Subscription and Notification both at Model - to - model and external over a websocket interface.
Facet Type Name | SffTopicFacet |
---|
Language Support | Subscribe and Notification Code Block |
---|
language | xml |
---|
title | Subscribe Example |
---|
linenumbers | true |
---|
| <Subscribe sid="test" topic="test.ws.*">
<Action>
<!-- Take Some Action -->
</Action>
</Subscribe> |
|
---|
Transports | HttpServerExtensionArgs WsServerExtensionArg |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Code Block |
---|
language | xml |
---|
title | SffTopicFacet Example |
---|
linenumbers | true |
---|
| <NewFacetInstance fid="topic" name="topic" type="SffTopicFacet">
<OnActivate>
</OnActivate>
<OnOpen ModifyPipeline="WsServerExtensionArgs"/>
<OnError>
<DoResponse>
<Process>
<Message type="xml">
<Value>
<Error>[:$Error:]</Error>
<ErrorRequest>[:$Request:]</ErrorRequest>
</Value>
</Message>
</Process>
</DoResponse>
</OnError>
</NewFacetInstance> |
|
---|
Associated within Other Facet Types | Public instances are associated within TQL Facet Types |
---|
Use Cases | - Allows Model to model and external Subscription and Notifications.
- Private instance of Topic Facet is a requirement for Model subscription to function correctly as part of Tql Facet types.
|
---|
Scheduling
Sequence Facet supports scheduling of tasks at given time and frequency.
Facet Type Name | SffSeqeunceFacet |
---|
Language Support | Sequence Language Code Block |
---|
language | xml |
---|
title | Sequence Language Example |
---|
linenumbers | true |
---|
| <Execute eid="test" schedule="[30../10sec]" limit="15">
<Action>
<JavaScript>
sffLog.info("Doing something...");
</JavaScript>
</Action>
</Execute> |
|
---|
Transports | HttpServerExtensionArgs WsServerExtensionArg |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Code Block |
---|
language | xml |
---|
title | SffSequenceFacet Example |
---|
linenumbers | true |
---|
| <NewFacetInstance fid="seq" name="seq" type="SffSequenceFacet">
<OnActivate>
<!-- Schedule something at the time of activation -->
</OnActivate>
<OnOpen ModifyPipeline="WsServerExtensionArgs"/>
</NewFacetInstance> |
|
---|
Use Cases | - Scheduling of tasks at given interval and frequency.
- Schedule Format is: StartTime..EndTime/Interval Where StartTime and EndTime can be a hierarchical dot-delimited format.
Example of dot-delimited format: 2015.MAY.25.14.30min means 2015-May-25:14:30. It is not necessary to specify time units on each element as long as there is at least one and you follow the standard time interval hierarchy (i.e. year-month-day-hour-minute-second-millisecond). In the above example, “MAY” is used by the system to match all the numerals with time units (i.e. it recognizes that if MAY is a month then to the left of it must be the year and to the right must be day, hour, minute etc.). For non-standard definitions, you can always specify time unit explicitly (e.g. 2015yr.128doy.15hr, where 2015 is a year, 128 is day of the year and 15 is hour of the day). Only 24 hours format is currently supported.
|
---|
Static Files
Static Files Facet Types allows users to serve static files using A-Stack
Facet Type Name | SffStaticFileFacet |
---|
Language Support | FacetScript |
---|
Transports | HttpServerExtensionArgs WsServerExtensionArg |
---|
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Code Block |
---|
language | xml |
---|
title | SffStaticFileFacet Example |
---|
linenumbers | true |
---|
| <NewFacetInstance fid="file" name="File" type="SffStaticFileFacet">
<OnActivate>
<Process BasePath="web" Resource="res"/>
</OnActivate>
</NewFacetInstance> |
|
---|
Use Cases | - Handy to serve your html5 Javascript Application using A-Stack. Avoid overhead of spinning yet another http file server!
|
---|