diff --git a/README.md b/README.md index 1bf4a64..1e15db1 100644 --- a/README.md +++ b/README.md @@ -19,11 +19,11 @@ For information on Siddhi and i ## Latest API Docs -Latest API Docs is 2.0.1. +Latest API Docs is 2.0.2. ## Features -* mongodb *(Store)*

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

+* mongodb *(Store)*

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

## Dependencies diff --git a/docs/api/2.0.2.md b/docs/api/2.0.2.md new file mode 100644 index 0000000..38777f9 --- /dev/null +++ b/docs/api/2.0.2.md @@ -0,0 +1,264 @@ +# API Docs - v2.0.2 + +!!! Info "Tested Siddhi Core version: *5.1.5*" + It could also support other Siddhi Core minor versions. + +## Store + +### mongodb *(Store)* +

+

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

+

+Syntax + +``` +@Store(type="mongodb", mongodb.uri="", collection.name="", secure.connection="", trust.store="", trust.store.password="", key.store="", key.store.password="") +@PrimaryKey("PRIMARY_KEY") +@Index("INDEX") +``` + +QUERY PARAMETERS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
mongodb.uri

The MongoDB URI for the MongoDB data store. The uri must be of the format
mongodb://[username:password@]host1[:port1][,hostN[:portN]][/[database][?options]]
The options specified in the uri will override any connection options specified in the deployment yaml file.

STRINGNoNo
collection.name

The name of the collection in the store this Event Table should be persisted as.

Name of the siddhi event table.STRINGYesNo
secure.connection

Describes enabling the SSL for the mongodb connection

falseSTRINGYesNo
trust.store

File path to the trust store.

${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
trust.store.password

Password to access the trust store

wso2carbonSTRINGYesNo
key.store

File path to the keystore.

${carbon.home}/resources/security/client-truststore.jksSTRINGYesNo
key.store.password

Password to access the keystore

wso2carbonSTRINGYesNo
+ +System Parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameDescriptionDefault ValuePossible Parameters
applicationName

Sets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection.

nullthe logical name of the application using this MongoClient. The UTF-8 encoding may not exceed 128 bytes.
cursorFinalizerEnabled

Sets whether cursor finalizers are enabled.

truetrue
false
requiredReplicaSetName

The name of the replica set

nullthe logical name of the replica set
sslEnabled

Sets whether to initiate connection with TSL/SSL enabled. true: Initiate the connection with TLS/SSL. false: Initiate the connection without TLS/SSL.

falsetrue
false
trustStore

File path to the trust store.

${carbon.home}/resources/security/client-truststore.jksAny valid file path.
trustStorePassword

Password to access the trust store

wso2carbonAny valid password.
keyStore

File path to the keystore.

${carbon.home}/resources/security/client-truststore.jksAny valid file path.
keyStorePassword

Password to access the keystore

wso2carbonAny valid password.
connectTimeout

The time in milliseconds to attempt a connection before timing out.

10000Any positive integer
connectionsPerHost

The maximum number of connections in the connection pool.

100Any positive integer
minConnectionsPerHost

The minimum number of connections in the connection pool.

0Any natural number
maxConnectionIdleTime

The maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed. A zero value indicates no limit to the idle time. A pooled connection that has exceeded its idle time will be closed and replaced when necessary by a new connection.

0Any positive integer
maxWaitTime

The maximum wait time in milliseconds that a thread may wait for a connection to become available. A value of 0 means that it will not wait. A negative value means to wait indefinitely

120000Any integer
threadsAllowedToBlockForConnectionMultiplier

The maximum number of connections allowed per host for this MongoClient instance. Those connections will be kept in a pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection.

100Any natural number
maxConnectionLifeTime

The maximum life time of a pooled connection. A zero value indicates no limit to the life time. A pooled connection that has exceeded its life time will be closed and replaced when necessary by a new connection.

0Any positive integer
socketKeepAlive

Sets whether to keep a connection alive through firewalls

falsetrue
false
socketTimeout

The time in milliseconds to attempt a send or receive on a socket before the attempt times out. Default 0 means never to timeout.

0Any natural integer
writeConcern

The write concern to use.

acknowledgedacknowledged
w1
w2
w3
unacknowledged
fsynced
journaled
replica_acknowledged
normal
safe
majority
fsync_safe
journal_safe
replicas_safe
readConcern

The level of isolation for the reads from replica sets.

defaultlocal
majority
linearizable
readPreference

Specifies the replica set read preference for the connection.

primaryprimary
secondary
secondarypreferred
primarypreferred
nearest
localThreshold

The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.

15Any natural number
serverSelectionTimeout

Specifies how long (in milliseconds) to block for server selection before throwing an exception. A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely.

30000Any integer
heartbeatSocketTimeout

The socket timeout for connections used for the cluster heartbeat. A value of 0 means that it will timeout immediately if no cluster member is available. A negative value means to wait indefinitely.

20000Any integer
heartbeatConnectTimeout

The connect timeout for connections used for the cluster heartbeat. A value of 0 means that it will timeout immediately if no cluster member is available. A negative value means to wait indefinitely.

20000Any integer
heartbeatFrequency

Specify the interval (in milliseconds) between checks, counted from the end of the previous check until the beginning of the next one.

10000Any positive integer
minHeartbeatFrequency

Sets the minimum heartbeat frequency. In the event that the driver has to frequently re-check a server's availability, it will wait at least this long since the previous check to avoid wasted effort.

500Any positive integer
+ +Examples +EXAMPLE 1 +``` +@Store(type="mongodb",mongodb.uri="mongodb://admin:admin@localhost/Foo") +@PrimaryKey("symbol") +@IndexBy("volume 1 {background:true,unique:true}") +define table FooTable (symbol string, price float, volume long); +``` +

+

This will create a collection called FooTable for the events to be saved with symbol as Primary Key(unique index at mongod level) and index for the field volume will be created in ascending order with the index option to create the index in the background.

Note:
@PrimaryKey: This specifies a list of comma-separated values to be treated as unique fields in the table. Each record in the table must have a unique combination of values for the fields specified here.

@IndexBy: This specifies the fields that must be indexed at the database level. You can specify multiple values as a come-separated list. A single value to be in the format,
“<FieldName> <SortOrder> <IndexOptions>”
<SortOrder> - ( 1) for Ascending and (-1) for Descending
<IndexOptions> - Index Options must be defined inside curly brackets. {} to be used for default options. Options must follow the standard mongodb index options format. Reference : https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/
Example : “symbol 1 {“unique”:true}”

+

diff --git a/docs/api/latest.md b/docs/api/latest.md index 8e10bb9..38777f9 100644 --- a/docs/api/latest.md +++ b/docs/api/latest.md @@ -1,12 +1,16 @@ -# API Docs - v2.0.2-SNAPSHOT +# API Docs - v2.0.2 -## Store - -### mongodb *(Store)* +!!! Info "Tested Siddhi Core version: *5.1.5*" + It could also support other Siddhi Core minor versions. -

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

+## Store +### mongodb *(Store)* +

+

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

+

Syntax + ``` @Store(type="mongodb", mongodb.uri="", collection.name="", secure.connection="", trust.store="", trust.store.password="", key.store="", key.store.password="") @PrimaryKey("PRIMARY_KEY") @@ -25,7 +29,7 @@ mongodb.uri - The MongoDB URI for the MongoDB data store. The uri must be of the format
mongodb://[username:password@]host1[:port1][,hostN[:portN]][/[database][?options]]
The options specified in the uri will override any connection options specified in the deployment yaml file. +

The MongoDB URI for the MongoDB data store. The uri must be of the format
mongodb://[username:password@]host1[:port1][,hostN[:portN]][/[database][?options]]
The options specified in the uri will override any connection options specified in the deployment yaml file.

STRING No @@ -33,7 +37,7 @@ collection.name - The name of the collection in the store this Event Table should be persisted as. +

The name of the collection in the store this Event Table should be persisted as.

Name of the siddhi event table. STRING Yes @@ -41,7 +45,7 @@ secure.connection - Describes enabling the SSL for the mongodb connection +

Describes enabling the SSL for the mongodb connection

false STRING Yes @@ -49,7 +53,7 @@ trust.store - File path to the trust store. +

File path to the trust store.

${carbon.home}/resources/security/client-truststore.jks STRING Yes @@ -57,7 +61,7 @@ trust.store.password - Password to access the trust store +

Password to access the trust store

wso2carbon STRING Yes @@ -65,7 +69,7 @@ key.store - File path to the keystore. +

File path to the keystore.

${carbon.home}/resources/security/client-truststore.jks STRING Yes @@ -73,7 +77,7 @@ key.store.password - Password to access the keystore +

Password to access the keystore

wso2carbon STRING Yes @@ -91,157 +95,157 @@ applicationName - Sets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection. +

Sets the logical name of the application using this MongoClient. The application name may be used by the client to identify the application to the server, for use in server logs, slow query logs, and profile collection.

null the logical name of the application using this MongoClient. The UTF-8 encoding may not exceed 128 bytes. cursorFinalizerEnabled - Sets whether cursor finalizers are enabled. +

Sets whether cursor finalizers are enabled.

true true
false requiredReplicaSetName - The name of the replica set +

The name of the replica set

null the logical name of the replica set sslEnabled - Sets whether to initiate connection with TSL/SSL enabled. true: Initiate the connection with TLS/SSL. false: Initiate the connection without TLS/SSL. +

Sets whether to initiate connection with TSL/SSL enabled. true: Initiate the connection with TLS/SSL. false: Initiate the connection without TLS/SSL.

false true
false trustStore - File path to the trust store. +

File path to the trust store.

${carbon.home}/resources/security/client-truststore.jks Any valid file path. trustStorePassword - Password to access the trust store +

Password to access the trust store

wso2carbon Any valid password. keyStore - File path to the keystore. +

File path to the keystore.

${carbon.home}/resources/security/client-truststore.jks Any valid file path. keyStorePassword - Password to access the keystore +

Password to access the keystore

wso2carbon Any valid password. connectTimeout - The time in milliseconds to attempt a connection before timing out. +

The time in milliseconds to attempt a connection before timing out.

10000 Any positive integer connectionsPerHost - The maximum number of connections in the connection pool. +

The maximum number of connections in the connection pool.

100 Any positive integer minConnectionsPerHost - The minimum number of connections in the connection pool. +

The minimum number of connections in the connection pool.

0 Any natural number maxConnectionIdleTime - The maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed. A zero value indicates no limit to the idle time. A pooled connection that has exceeded its idle time will be closed and replaced when necessary by a new connection. +

The maximum number of milliseconds that a connection can remain idle in the pool before being removed and closed. A zero value indicates no limit to the idle time. A pooled connection that has exceeded its idle time will be closed and replaced when necessary by a new connection.

0 Any positive integer maxWaitTime - The maximum wait time in milliseconds that a thread may wait for a connection to become available. A value of 0 means that it will not wait. A negative value means to wait indefinitely +

The maximum wait time in milliseconds that a thread may wait for a connection to become available. A value of 0 means that it will not wait. A negative value means to wait indefinitely

120000 Any integer threadsAllowedToBlockForConnectionMultiplier - The maximum number of connections allowed per host for this MongoClient instance. Those connections will be kept in a pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection. +

The maximum number of connections allowed per host for this MongoClient instance. Those connections will be kept in a pool when idle. Once the pool is exhausted, any operation requiring a connection will block waiting for an available connection.

100 Any natural number maxConnectionLifeTime - The maximum life time of a pooled connection. A zero value indicates no limit to the life time. A pooled connection that has exceeded its life time will be closed and replaced when necessary by a new connection. +

The maximum life time of a pooled connection. A zero value indicates no limit to the life time. A pooled connection that has exceeded its life time will be closed and replaced when necessary by a new connection.

0 Any positive integer socketKeepAlive - Sets whether to keep a connection alive through firewalls +

Sets whether to keep a connection alive through firewalls

false true
false socketTimeout - The time in milliseconds to attempt a send or receive on a socket before the attempt times out. Default 0 means never to timeout. +

The time in milliseconds to attempt a send or receive on a socket before the attempt times out. Default 0 means never to timeout.

0 Any natural integer writeConcern - The write concern to use. +

The write concern to use.

acknowledged acknowledged
w1
w2
w3
unacknowledged
fsynced
journaled
replica_acknowledged
normal
safe
majority
fsync_safe
journal_safe
replicas_safe readConcern - The level of isolation for the reads from replica sets. +

The level of isolation for the reads from replica sets.

default local
majority
linearizable readPreference - Specifies the replica set read preference for the connection. +

Specifies the replica set read preference for the connection.

primary primary
secondary
secondarypreferred
primarypreferred
nearest localThreshold - The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances. +

The size (in milliseconds) of the latency window for selecting among multiple suitable MongoDB instances.

15 Any natural number serverSelectionTimeout - Specifies how long (in milliseconds) to block for server selection before throwing an exception. A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely. +

Specifies how long (in milliseconds) to block for server selection before throwing an exception. A value of 0 means that it will timeout immediately if no server is available. A negative value means to wait indefinitely.

30000 Any integer heartbeatSocketTimeout - The socket timeout for connections used for the cluster heartbeat. A value of 0 means that it will timeout immediately if no cluster member is available. A negative value means to wait indefinitely. +

The socket timeout for connections used for the cluster heartbeat. A value of 0 means that it will timeout immediately if no cluster member is available. A negative value means to wait indefinitely.

20000 Any integer heartbeatConnectTimeout - The connect timeout for connections used for the cluster heartbeat. A value of 0 means that it will timeout immediately if no cluster member is available. A negative value means to wait indefinitely. +

The connect timeout for connections used for the cluster heartbeat. A value of 0 means that it will timeout immediately if no cluster member is available. A negative value means to wait indefinitely.

20000 Any integer heartbeatFrequency - Specify the interval (in milliseconds) between checks, counted from the end of the previous check until the beginning of the next one. +

Specify the interval (in milliseconds) between checks, counted from the end of the previous check until the beginning of the next one.

10000 Any positive integer minHeartbeatFrequency - Sets the minimum heartbeat frequency. In the event that the driver has to frequently re-check a server's availability, it will wait at least this long since the previous check to avoid wasted effort. +

Sets the minimum heartbeat frequency. In the event that the driver has to frequently re-check a server's availability, it will wait at least this long since the previous check to avoid wasted effort.

500 Any positive integer @@ -255,5 +259,6 @@ @IndexBy("volume 1 {background:true,unique:true}") define table FooTable (symbol string, price float, volume long); ``` -

This will create a collection called FooTable for the events to be saved with symbol as Primary Key(unique index at mongod level) and index for the field volume will be created in ascending order with the index option to create the index in the background.

Note:
@PrimaryKey: This specifies a list of comma-separated values to be treated as unique fields in the table. Each record in the table must have a unique combination of values for the fields specified here.

@IndexBy: This specifies the fields that must be indexed at the database level. You can specify multiple values as a come-separated list. A single value to be in the format,
“<FieldName> <SortOrder> <IndexOptions>”
<SortOrder> - ( 1) for Ascending and (-1) for Descending
<IndexOptions> - Index Options must be defined inside curly brackets. {} to be used for default options. Options must follow the standard mongodb index options format. Reference : https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/
Example : “symbol 1 {“unique”:true}”

- +

+

This will create a collection called FooTable for the events to be saved with symbol as Primary Key(unique index at mongod level) and index for the field volume will be created in ascending order with the index option to create the index in the background.

Note:
@PrimaryKey: This specifies a list of comma-separated values to be treated as unique fields in the table. Each record in the table must have a unique combination of values for the fields specified here.

@IndexBy: This specifies the fields that must be indexed at the database level. You can specify multiple values as a come-separated list. A single value to be in the format,
“<FieldName> <SortOrder> <IndexOptions>”
<SortOrder> - ( 1) for Ascending and (-1) for Descending
<IndexOptions> - Index Options must be defined inside curly brackets. {} to be used for default options. Options must follow the standard mongodb index options format. Reference : https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/
Example : “symbol 1 {“unique”:true}”

+

diff --git a/docs/index.md b/docs/index.md index 8af7b80..1e15db1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -19,19 +19,47 @@ For information on Siddhi and i ## Latest API Docs -Latest API Docs is 2.0.1. +Latest API Docs is 2.0.2. ## Features -* mongodb *(Store)*

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

+* mongodb *(Store)*

Using this extension a MongoDB Event Table can be configured to persist events in a MongoDB of user's choice.

## Dependencies -There are no other dependencies needed for this extension. +MongoDB connector jar should be added to the runtime. For installing third party connectors on various Siddhi execution environments refer Siddhi documentation section on adding third party libraries. ## Installation -For installing this extension on various siddhi execution environments refer Siddhi documentation section on adding extensions. +For installing this extension on various Siddhi execution environments refer Siddhi documentation section on adding extensions. + +## Running Integration tests in docker containers(Optional) + +The MongoDB functionality are tested with the docker base integration test framework. The test framework initializes the docker container according to the given profile before executing the test suite. + +1. Install and run docker in daemon mode. + + * Installing docker on Linux,
+ Note:
These commands retrieve content from get.docker.com web in a quiet output-document mode and install.Then we need to stop docker service as it needs to restart docker in daemon mode. After that, we need to export docker daemon host. + + wget -qO- https://get.docker.com/ | sh + sudo service dockerd stop + export DOCKER_HOST=tcp://172.17.0.1:4326 + docker daemon -H tcp://172.17.0.1:4326 + + * On installing docker on Mac, see Get started with Docker for Mac + + * On installing docker on Windows, see Get started with Docker for Windows + +2. To run the integration tests, issue the following commands. + + * MongoDB without SSL connection + + mvn verify -P mongod -Ddocker.removeVolumes=true + + * MongoDB with SSL connection + + mvn verify -P mongod-ssl -Ddocker.removeVolumes=true ## Support and Contribution diff --git a/mkdocs.yml b/mkdocs.yml index c2b4992..9515606 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,44 +12,45 @@ theme: primary: teal accent: teal extra_css: - - assets/stylesheets/extra.css +- assets/stylesheets/extra.css extra_javascript: - - assets/javascripts/extra.js +- assets/javascripts/extra.js extra: social: - - type: github - link: https://github.com/siddhi-io/siddhi - - type: medium - link: https://medium.com/siddhi-io - - type: twitter - link: https://twitter.com/siddhi_io - - type: linkedin - link: https://www.linkedin.com/groups/13553064 + - type: github + link: https://github.com/siddhi-io/siddhi + - type: medium + link: https://medium.com/siddhi-io + - type: twitter + link: https://twitter.com/siddhi_io + - type: linkedin + link: https://www.linkedin.com/groups/13553064 google_analytics: - - UA-103065-28 - - auto +- UA-103065-28 +- auto markdown_extensions: - - markdown.extensions.admonition +- markdown.extensions.admonition pages: - - Information: index.md - - API Docs: - - latest: api/latest.md - - 2.0.1: api/2.0.1.md - - 2.0.0: api/2.0.0.md - - 1.1.0: api/1.1.0.md - - 1.0.21: api/1.0.21.md - - 1.0.20: api/1.0.20.md - - 1.0.19: api/1.0.19.md - - 1.0.18: api/1.0.18.md - - 1.0.17: api/1.0.17.md - - 1.0.16: api/1.0.16.md - - 1.0.15: api/1.0.15.md - - 1.0.14: api/1.0.14.md - - 1.0.13: api/1.0.13.md - - 1.0.12: api/1.0.12.md - - 1.0.11: api/1.0.11.md - - 1.0.10: api/1.0.10.md - - 1.0.9: api/1.0.9.md - - 1.0.8: api/1.0.8.md - - 1.0.7: api/1.0.7.md - - License: license.md +- Information: index.md +- API Docs: + - latest: api/latest.md + - 2.0.2: api/2.0.2.md + - 2.0.1: api/2.0.1.md + - 2.0.0: api/2.0.0.md + - 1.1.0: api/1.1.0.md + - 1.0.21: api/1.0.21.md + - 1.0.20: api/1.0.20.md + - 1.0.19: api/1.0.19.md + - 1.0.18: api/1.0.18.md + - 1.0.17: api/1.0.17.md + - 1.0.16: api/1.0.16.md + - 1.0.15: api/1.0.15.md + - 1.0.14: api/1.0.14.md + - 1.0.13: api/1.0.13.md + - 1.0.12: api/1.0.12.md + - 1.0.11: api/1.0.11.md + - 1.0.10: api/1.0.10.md + - 1.0.9: api/1.0.9.md + - 1.0.8: api/1.0.8.md + - 1.0.7: api/1.0.7.md +- License: license.md