-
Notifications
You must be signed in to change notification settings - Fork 10
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 2.0.10] update documentation for release 2.0.10
- Loading branch information
1 parent
c70c4d5
commit 802df88
Showing
5 changed files
with
191 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,183 @@ | ||
# API Docs - v2.0.10 | ||
|
||
!!! Info "Tested Siddhi Core version: *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/">5.1.5</a>*" | ||
It could also support other Siddhi Core minor versions. | ||
|
||
## Sink | ||
|
||
### nats *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#sink">(Sink)</a>* | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">NATS Sink allows users to subscribe to a NATS broker and publish messages.</p> | ||
<p></p> | ||
<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span> | ||
|
||
``` | ||
@sink(type="nats", destination="<STRING>", bootstrap.servers="<STRING>", client.id="<STRING>", cluster.id="<STRING>", @map(...))) | ||
``` | ||
|
||
<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">destination</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">Subject name which NATS sink should publish to.</p></td> | ||
<td style="vertical-align: top"></td> | ||
<td style="vertical-align: top">STRING</td> | ||
<td style="vertical-align: top">No</td> | ||
<td style="vertical-align: top">Yes</td> | ||
</tr> | ||
<tr> | ||
<td style="vertical-align: top">bootstrap.servers</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">The NATS based url of the NATS server.</p></td> | ||
<td style="vertical-align: top">nats://localhost:4222</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">client.id</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">The identifier of the client publishing/connecting to the NATS broker. Should be unique for each client connecting to the server/cluster.</p></td> | ||
<td style="vertical-align: top">None</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">cluster.id</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">The identifier of the NATS server/cluster.</p></td> | ||
<td style="vertical-align: top">test-cluster</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='nats', @map(type='xml'), destination='SP_NATS_OUTPUT_TEST', bootstrap.servers='nats://localhost:4222',client.id='nats_client',server.id='test-cluster') | ||
define stream outputStream (name string, age int, country string); | ||
``` | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">This example shows how to publish to a NATS subject with all supporting configurations. With the following configuration the sink identified as 'nats-client' will publish to a subject named as 'SP_NATS_OUTPUT_TEST' which resides in a nats instance with a cluster id of 'test-cluster', running in localhost and listening to the port 4222 for client connection.</p> | ||
<p></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='nats', @map(type='xml'), destination='SP_NATS_OUTPUT_TEST') | ||
define stream outputStream (name string, age int, country string); | ||
``` | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">This example shows how to publish to a NATS subject with mandatory configurations. With the following configuration the sink identified with an auto generated client id will publish to a subject named as 'SP_NATS_OUTPUT_TEST' which resides in a nats instance with a cluster id of 'test-cluster', running in localhost and listening to the port 4222 for client connection.</p> | ||
<p></p> | ||
## Source | ||
|
||
### nats *<a target="_blank" href="http://siddhi.io/en/v5.1/docs/query-guide/#source">(Source)</a>* | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">NATS Source allows users to subscribe to a NATS broker and receive messages. It has the ability to receive all the message types supported by NATS.</p> | ||
<p></p> | ||
<span id="syntax" class="md-typeset" style="display: block; font-weight: bold;">Syntax</span> | ||
|
||
``` | ||
@source(type="nats", destination="<STRING>", bootstrap.servers="<STRING>", client.id="<STRING>", cluster.id="<STRING>", queue.group.name="<STRING>", durable.name="<STRING>", subscription.sequence="<STRING>", @map(...))) | ||
``` | ||
|
||
<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">destination</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">Subject name which NATS Source should subscribe to.</p></td> | ||
<td style="vertical-align: top"></td> | ||
<td style="vertical-align: top">STRING</td> | ||
<td style="vertical-align: top">No</td> | ||
<td style="vertical-align: top">No</td> | ||
</tr> | ||
<tr> | ||
<td style="vertical-align: top">bootstrap.servers</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">The NATS based url of the NATS server.</p></td> | ||
<td style="vertical-align: top">nats://localhost:4222</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">client.id</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">The identifier of the client subscribing/connecting to the NATS broker.</p></td> | ||
<td style="vertical-align: top">None</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">cluster.id</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">The identifier of the NATS server/cluster.</p></td> | ||
<td style="vertical-align: top">test-cluster</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">queue.group.name</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">This can be used when there is a requirement to share the load of a NATS subject. Clients belongs to the same queue group share the subscription load.</p></td> | ||
<td style="vertical-align: top">None</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">durable.name</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">This can be used to subscribe to a subject from the last acknowledged message when a client or connection failure happens. The client can be uniquely identified using the tuple (client.id, durable.name).</p></td> | ||
<td style="vertical-align: top">None</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">subscription.sequence</td> | ||
<td style="vertical-align: top; word-wrap: break-word"><p style="word-wrap: break-word;margin: 0;">This can be used to subscribe to a subject from a given number of message sequence. All the messages from the given point of sequence number will be passed to the client. If not provided then the either the persisted value or 0 will be used.</p></td> | ||
<td style="vertical-align: top">None</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> | ||
``` | ||
@source(type='nats', @map(type='text'), destination='SP_NATS_INPUT_TEST', bootstrap.servers='nats://localhost:4222',client.id='nats_client',server.id='test-cluster',queue.group.name = 'group_nats',durable.name = 'nats-durable',subscription.sequence = '100') | ||
define stream inputStream (name string, age int, country string); | ||
``` | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">This example shows how to subscribe to a NATS subject with all supporting configurations.With the following configuration the source identified as 'nats-client' will subscribes to a subject named as 'SP_NATS_INPUT_TEST' which resides in a nats instance with a cluster id of 'test-cluster', running in localhost and listening to the port 4222 for client connection. This subscription will receive all the messages from 100th in the subject.</p> | ||
<p></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='nats', @map(type='text'), destination='SP_NATS_INPUT_TEST', ) | ||
define stream inputStream (name string, age int, country string); | ||
``` | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">This example shows how to subscribe to a NATS subject with mandatory configurations.With the following configuration the source identified with an auto generated client id will subscribes to a subject named as 'SP_NATS_INTPUT_TEST' which resides in a nats instance with a cluster id of 'test-cluster', running in localhost and listening to the port 4222 for client connection. This will receive all available messages in the subject</p> | ||
<p></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='nats', @map(type='json', @attributes(name='$.name', age='$.age', country='$.country', sequenceNum='trp:sequenceNumber')), destination='SIDDHI_NATS_SOURCE_TEST_DEST', client.id='nats_client', bootstrap.servers='nats://localhost:4222', cluster.id='test-cluster') | ||
define stream inputStream (name string, age int, country string, sequenceNum string); | ||
``` | ||
<p></p> | ||
<p style="word-wrap: break-word;margin: 0;">This example shows how to pass NATS Streaming sequence number to the event.</p> | ||
<p></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
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