-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WSO2-Release] [Release 5.0.3] update documentation for release 5.0.3
- Loading branch information
1 parent
25439f5
commit 2aafe75
Showing
5 changed files
with
135 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
# API Docs - v5.0.3 | ||
|
||
## Sinkmapper | ||
|
||
### json *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#sink-mapper">(Sink Mapper)</a>* | ||
|
||
<p style="word-wrap: break-word">This extension is an Event to JSON output mapper. <br>Transports that publish messages can utilize this extension to convert Siddhi events to JSON messages. <br>You can either send a pre-defined JSON format or a custom JSON message.<br></p> | ||
|
||
<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span> | ||
``` | ||
@sink(..., @map(type="json", validate.json="<BOOL>", enclosing.element="<STRING>") | ||
``` | ||
|
||
<span id="query-parameters" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">QUERY PARAMETERS</span> | ||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th style="min-width: 20em">Description</th> | ||
<th>Default Value</th> | ||
<th>Possible Data Types</th> | ||
<th>Optional</th> | ||
<th>Dynamic</th> | ||
</tr> | ||
<tr> | ||
<td style="vertical-align: top">validate.json</td> | ||
<td style="vertical-align: top; word-wrap: break-word">If this property is set to <code>true</code>, it enables JSON validation for the JSON messages generated. <br>When validation is carried out, messages that do not adhere to proper JSON standards are dropped. This property is set to 'false' by default. <br></td> | ||
<td style="vertical-align: top">false</td> | ||
<td style="vertical-align: top">BOOL</td> | ||
<td style="vertical-align: top">Yes</td> | ||
<td style="vertical-align: top">No</td> | ||
</tr> | ||
<tr> | ||
<td style="vertical-align: top">enclosing.element</td> | ||
<td style="vertical-align: top; word-wrap: break-word">This specifies the enclosing element to be used if multiple events are sent in the same JSON message. <br>Siddhi treats the child elements of the given enclosing element as events and executes JSON expressions on them. <br>If an <code>enclosing.element</code> is not provided, the multiple event scenario is disregarded and JSON path is evaluated based on the root element.</td> | ||
<td style="vertical-align: top">$</td> | ||
<td style="vertical-align: top">STRING</td> | ||
<td style="vertical-align: top">Yes</td> | ||
<td style="vertical-align: top">No</td> | ||
</tr> | ||
</table> | ||
|
||
<span id="examples" class="md-typeset" style="display: block; font-weight: bold;">Examples</span> | ||
<span id="example-1" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 1</span> | ||
``` | ||
@sink(type='inMemory', topic='stock', @map(type='json')) | ||
define stream FooStream (symbol string, price float, volume long); | ||
``` | ||
<p style="word-wrap: break-word">Above configuration does a default JSON input mapping that generates the output given below.<br>{<br> "event":{<br> "symbol":WSO2,<br> "price":55.6,<br> "volume":100<br> }<br>}<br></p> | ||
|
||
<span id="example-2" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 2</span> | ||
``` | ||
@sink(type='inMemory', topic='{{symbol}}', @map(type='json', enclosing.element='$.portfolio', validate.json='true', @payload( """{"StockData":{"Symbol":"{{symbol}}","Price":{{price}}}"""))) | ||
define stream BarStream (symbol string, price float, volume long); | ||
``` | ||
<p style="word-wrap: break-word">The above configuration performs a custom JSON mapping that generates the following JSON message as the output.<br>{"portfolio":{<br> "StockData":{<br> "Symbol":WSO2,<br> "Price":55.6<br> }<br> }<br>}</p> | ||
|
||
## Sourcemapper | ||
|
||
### json *<a target="_blank" href="http://siddhi.io/documentation/siddhi-5.x/query-guide-5.x/#source-mapper">(Source Mapper)</a>* | ||
|
||
<p style="word-wrap: break-word">This extension is a JSON-to-Event input mapper. Transports that accept JSON messages can utilize this extension to convert an incoming JSON message into a Siddhi event. Users can either send a pre-defined JSON format, where event conversion happens without any configurations, or use the JSON path to map from a custom JSON message.<br>In default mapping, the JSON string of the event can be enclosed by the element "event", though optional.</p> | ||
|
||
<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span> | ||
``` | ||
@source(..., @map(type="json", enclosing.element="<STRING>", fail.on.missing.attribute="<BOOL>") | ||
``` | ||
|
||
<span id="query-parameters" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">QUERY PARAMETERS</span> | ||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th style="min-width: 20em">Description</th> | ||
<th>Default Value</th> | ||
<th>Possible Data Types</th> | ||
<th>Optional</th> | ||
<th>Dynamic</th> | ||
</tr> | ||
<tr> | ||
<td style="vertical-align: top">enclosing.element</td> | ||
<td style="vertical-align: top; word-wrap: break-word">This is used to specify the enclosing element when sending multiple events in the same JSON message. <br>Mapper treats the child elements of a given enclosing element as events and executes the JSON path expressions on these child elements. <br>If the enclosing.element is not provided then the multiple-event scenario is disregarded and the JSON path is evaluated based on the root element.</td> | ||
<td style="vertical-align: top">$</td> | ||
<td style="vertical-align: top">STRING</td> | ||
<td style="vertical-align: top">Yes</td> | ||
<td style="vertical-align: top">No</td> | ||
</tr> | ||
<tr> | ||
<td style="vertical-align: top">fail.on.missing.attribute</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><br>This parameter allows users to handle unknown attributes.The value of this can either be true or false. By default it is true. <br> If a JSON execution fails or returns null, mapper drops that message. <br>However, setting this property to false prompts mapper to send an event with a null value to Siddhi, where users can handle it as required, ie., assign a default value.)</td> | ||
<td style="vertical-align: top">true</td> | ||
<td style="vertical-align: top">BOOL</td> | ||
<td style="vertical-align: top">Yes</td> | ||
<td style="vertical-align: top">No</td> | ||
</tr> | ||
</table> | ||
|
||
<span id="examples" class="md-typeset" style="display: block; font-weight: bold;">Examples</span> | ||
<span id="example-1" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 1</span> | ||
``` | ||
@source(type='inMemory', topic='stock', @map(type='json')) | ||
define stream FooStream (symbol string, price float, volume long); | ||
``` | ||
<p style="word-wrap: break-word">This configuration performs a default JSON input mapping.<br> For a single event, the input is required to be in one of the following formats:<br>{<br> "event":{<br> "symbol":"WSO2",<br> "price":55.6,<br> "volume":100<br> }<br>}<br><br>or <br><br>{<br> "symbol":"WSO2",<br> "price":55.6,<br> "volume":100<br>}<br></p> | ||
|
||
<span id="example-2" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 2</span> | ||
``` | ||
@source(type='inMemory', topic='stock', @map(type='json')) | ||
define stream FooStream (symbol string, price float, volume long); | ||
``` | ||
<p style="word-wrap: break-word">This configuration performs a default JSON input mapping. <br>For multiple events, the input is required to be in one of the following formats:<br>[<br>{"event":{"symbol":"WSO2","price":55.6,"volume":100}},<br>{"event":{"symbol":"WSO2","price":56.6,"volume":99}},<br>{"event":{"symbol":"WSO2","price":57.6,"volume":80}}<br>]<br><br>or <br><br>[<br>{"symbol":"WSO2","price":55.6,"volume":100},<br>{"symbol":"WSO2","price":56.6,"volume":99},<br>{"symbol":"WSO2","price":57.6,"volume":80}<br>]</p> | ||
|
||
<span id="example-3" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 3</span> | ||
``` | ||
@source(type='inMemory', topic='stock', @map(type='json', enclosing.element="$.portfolio", @attributes(symbol = "company.symbol", price = "price", volume = "volume"))) | ||
``` | ||
<p style="word-wrap: break-word">This configuration performs a custom JSON mapping.<br>For a single event, the expected input is similar to the one shown below:<br>.{<br> "portfolio":{<br> "stock":{ "volume":100,<br> "company":{<br> "symbol":"WSO2"<br> },<br> "price":55.6<br> }<br>}<br></p> | ||
|
||
<span id="example-4" class="md-typeset" style="display: block; color: rgba(0, 0, 0, 0.54); font-size: 12.8px; font-weight: bold;">EXAMPLE 4</span> | ||
``` | ||
@source(type='inMemory', topic='stock', @map(type='json', enclosing.element="$.portfolio", @attributes(symbol = "stock.company.symbol", price = "stock.price", volume = "stock.volume"))) | ||
define stream FooStream (symbol string, price float, volume long); | ||
``` | ||
<p style="word-wrap: break-word">The configuration performs a custom JSON mapping.<br>For multiple events, expected input looks as follows.<br>.{"portfolio":<br> [ {"stock":{"volume":100,"company":{"symbol":"wso2"},"price":56.6}}, {"stock":{"volume":200,"company":{"symbol":"wso2"},"price":57.6}} ]<br>}<br></p> | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# API Docs - v5.0.2 | ||
# API Docs - v5.0.3 | ||
|
||
## Sinkmapper | ||
|
||
|
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