Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vinoja98 committed Sep 3, 2022
0 parents commit 62059f4
Show file tree
Hide file tree
Showing 35 changed files with 1,663 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:jni+resolve=off",
"java.configuration.updateBuildConfiguration": "interactive"
}
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Siddhi Store ${typeOfIOinCamelCase}
======================================

The **siddhi-io-live extension** is an extension to <a target="_blank" href="https://siddhi.io">Siddhi</a> that receives and publishes events via

For information on <a target="_blank" href="https://siddhi.io/">Siddhi</a> and it's features refer <a target="_blank" href="https://siddhi.io/redirect/docs.html">Siddhi Documentation</a>.

## Download

Versions with group id `io.siddhi.extension.io.*` from <a target="_blank" href="https://mvnrepository.com/artifact/io.siddhi.extension.io.live/siddhi-io-live/">here</a>.

## Latest API Docs

## Features

## Dependencies

## Installation

For installing this extension on various Siddhi execution environments refer Siddhi documentation section on <a target="_blank" href="https://siddhi.io/redirect/add-extensions.html">adding extensions</a>.

## Support and Contribution

* We encourage users to ask questions and get support via <a target="_blank" href="https://stackoverflow.com/questions/tagged/siddhi">StackOverflow</a>, make sure to add the `siddhi` tag to the issue for better response.

* If you find any issues related to the extension please report them on <a target="_blank" href="https://github.com/siddhi-io/siddhi-io-live/issues">the issue tracker</a>.

* For production support and other contribution related information refer <a target="_blank" href="https://siddhi.io/community/">Siddhi Community</a> documentation.
7 changes: 7 additions & 0 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions/>
156 changes: 156 additions & 0 deletions component/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>io.siddhi.extension.io.live</groupId>
<artifactId>siddhi-io-live-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>siddhi-io-live</artifactId>
<packaging>bundle</packaging>
<name>Siddhi IO Live extension</name>
<dependencies>

<dependency>
<groupId>com.arangodb</groupId>
<artifactId>arangodb-java-driver</artifactId>
<version>6.18.0</version>
</dependency>

<dependency>
<groupId>io.siddhi</groupId>
<artifactId>siddhi-core</artifactId>
</dependency>
<dependency>
<groupId>io.siddhi</groupId>
<artifactId>siddhi-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.siddhi</groupId>
<artifactId>siddhi-query-compiler</artifactId>
</dependency>
<dependency>
<groupId>io.siddhi</groupId>
<artifactId>siddhi-query-api</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
<dependency>
<groupId>io.siddhi.extension.map.xml</groupId>
<artifactId>siddhi-map-xml</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.siddhi.extension.map.json</groupId>
<artifactId>siddhi-map-json</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>documentation-deploy</id>
<build>
<plugins>
<plugin>
<groupId>io.siddhi</groupId>
<artifactId>siddhi-doc-gen</artifactId>
<version>${siddhi.version}</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>deploy-mkdocs-github-pages</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>${surefireArgLine} -ea -Xmx512m</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.plugin.version}</version>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${basedir}/target/coverage-reports/jacoco.exec</destFile>
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>jacoco-site</id>
<phase>post-integration-test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>${basedir}/target/coverage-reports/jacoco.exec</dataFile>
<outputDirectory>${basedir}/target/coverage-reports/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Export-Package>
io.siddhi.extension.io.live.*,
io.siddhi.extension.io.live.*
</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
<Include-Resource>
META-INF=target/classes/META-INF,
{maven-resources}
</Include-Resource>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
162 changes: 162 additions & 0 deletions component/src/main/java/io/siddhi/extension/io/live/sink/LiveSink.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
package io.siddhi.extension.io.live.sink;

import io.siddhi.annotation.Example;
import io.siddhi.annotation.Extension;
import io.siddhi.core.config.SiddhiAppContext;
import io.siddhi.core.exception.ConnectionUnavailableException;
import io.siddhi.core.stream.ServiceDeploymentInfo;
import io.siddhi.core.stream.output.sink.Sink;
import io.siddhi.core.util.config.ConfigReader;
import io.siddhi.core.util.snapshot.state.State;
import io.siddhi.core.util.snapshot.state.StateFactory;
import io.siddhi.core.util.transport.DynamicOptions;
import io.siddhi.core.util.transport.OptionHolder;
import io.siddhi.query.api.definition.StreamDefinition;

/**
* This is a sample class-level comment, explaining what the extension class does.
*/

/**
* Annotation of Siddhi Extension.
* <pre><code>
* eg:-
* {@literal @}Extension(
* name = "The name of the extension",
* namespace = "The namespace of the extension",
* description = "The description of the extension (optional).",
* //Sink configurations
* parameters = {
* {@literal @}Parameter(name = "The name of the first parameter", type = "Supprted parameter types.
* eg:{DataType.STRING,DataType.INT, DataType.LONG etc},dynamic=false ,optinal=true/false ,
* if optional =true then assign default value according the type")
* System parameter is used to define common extension wide
* },
* examples = {
* {@literal @}Example({"Example of the first CustomExtension contain syntax and description.Here,
* Syntax describe default mapping for SourceMapper and description describes
* the output of according this syntax},
* }
* </code></pre>
*/

@Extension(
name = "live",
namespace = "sink",
description = " ",
parameters = {
/*@Parameter(name = " ",
description = " " ,
dynamic = false/true,
optional = true/false, defaultValue = " ",
type = {DataType.INT, DataType.BOOL, DataType.STRING, DataType.DOUBLE,etc }),
type = {DataType.INT, DataType.BOOL, DataType.STRING, DataType.DOUBLE, }),*/
},
examples = {
@Example(
syntax = " ",
description = " "
)
}
)
// For more information refer https://siddhi.io/en/v5.0/docs/query-guide/#sink
public class LiveSink extends Sink {

/**
* The initialization method for {@link Sink}, will be called before other methods. It used to validate
* all configurations and to get initial values.
*
* @param streamDefinition containing stream definition bind to the {@link Sink}
* @param optionHolder Option holder containing static and dynamic configuration related
* to the {@link Sink}
* @param configReader to read the sink related system configuration.
* @param siddhiAppContext the context of the {@link io.siddhi.query.api.SiddhiApp} used to
* get siddhi related utility functions.
* @return StateFactory for the Function which contains logic for the updated state based on arrived events.
*/
@Override
protected StateFactory init(StreamDefinition streamDefinition, OptionHolder optionHolder, ConfigReader configReader,
SiddhiAppContext siddhiAppContext) {
return null;
}

/**
* Returns the list of classes which this sink can consume.
* Based on the type of the sink, it may be limited to being able to publish specific type of classes.
* For example, a sink of type file can only write objects of type String .
*
* @return array of supported classes , if extension can support of any types of classes
* then return empty array .
*/
@Override
public Class[] getSupportedInputEventClasses() {
return new Class[0];
}

/**
* Returns a list of supported dynamic options (that means for each event value of the option can change) by
* the transport.
*
* @return the list of supported dynamic option keys
*/
@Override
public String[] getSupportedDynamicOptions() {
return new String[0];
}

/**
* Give information to the deployment about the service exposed by the sink.
*
* @return ServiceDeploymentInfo Service related information to the deployment
*/
@Override
protected ServiceDeploymentInfo exposeServiceDeploymentInfo() {
return null;
}

/**
* This method will be called before the processing method.
* Intention to establish connection to publish event.
*
* @throws ConnectionUnavailableException if end point is unavailable the ConnectionUnavailableException thrown
* such that the system will take care retrying for connection
*/
@Override
public void connect() throws ConnectionUnavailableException {

}

/**
* This method will be called when events need to be published via this sink.
*
* @param payload payload of the event based on the supported event class exported by the extensions
* @param dynamicOptions holds the dynamic options of this sink and Use this object to obtain dynamic options.
* @param state current state of the sink
* @throws ConnectionUnavailableException if end point is unavailable the ConnectionUnavailableException thrown
* such that the system will take care retrying for connection
*/
@Override
public void publish(Object payload, DynamicOptions dynamicOptions, State state)
throws ConnectionUnavailableException {

}

/**
* Called after all publishing is done, or when {@link ConnectionUnavailableException} is thrown
* Implementation of this method should contain the steps needed to disconnect from the sink.
*/
@Override
public void disconnect() {

}

/**
* The method can be called when removing an event receiver.
* The cleanups that have to be done after removing the receiver could be done here.
*/
@Override
public void destroy() {

}

}
Loading

0 comments on commit 62059f4

Please sign in to comment.