Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Add the JAR files listed below to your class path. Note that ${carbon.analytics-commons.version} refers to the version of the carbon -analytics commons github repository -  https://github.com/wso2/carbon-analytics-commonscommon/. It is always recommended to use the jar file from the latest released version.

...

Alternatively, add the following Maven project dependency entries to your POM file. Note that ${carbon.commonsanalytics-common.version} refers to the version of the carbon-commons github analytics-common github repository -   https://github.com/wso2/carbon-commonsanalytics-common/. It is always recommended to use the dependency entry from the latest released version.

 

Code Block
languagehtml/xml
titleMaven repository
<repositories>
    <repository>
        <id>wso2-nexus</id>
        <name>WSO2 internal Repository</name>
        <url>http://maven.wso2.org/nexus/content/groups/wso2-public/</url>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
    </repository>
    <repository>
        <id>wso2.releases</id>
        <name>WSO2 internal Repository</name>
        <url>http://maven.wso2.org/nexus/content/repositories/releases/</url>
        	<releases>
            <enabled>true</enabled>
            <updatePolicy>daily</updatePolicy>
            <checksumPolicy>ignore</checksumPolicy>
        </releases>
    </repository>
    <repository>
        <id>wso2.snapshots</id>
        	<name>Apache Snapshot Repository</name>
        	<url>http://maven.wso2.org/nexus/content/repositories/snapshots/</url>
        	<snapshots>
            	<enabled>true</enabled>
            	<updatePolicy>daily</updatePolicy>
        	</snapshots>
        	<releases>
            	<enabled>false</enabled>
        	</releases>
    	</repository>
</repositories>
Code Block
languagehtml/xml
titleMaven pom dependency
<dependency>
    <groupId>org.wso2.carbon<carbon.analytics-common</groupId>
    <artifactId>org.wso2.carbon.databridge.agent</artifactId>
    <version>${carbon.commonsanalytics-common.version}</version>
</dependency>
<dependency>
    <groupId>org.wso2.carbon<carbon.analytics-common</groupId>
    <artifactId>org.wso2.carbon.databridge.commons</artifactId>
    <version>${carbon.commonsanalytics-common.version}</version>
</dependency>
<dependency>
    <groupId>org.wso2.carbon.carbon<analytics-common</groupId>
    <artifactId>org.wso2.carbon.databridge.commons.thrift</artifactId>
    <version>${carbon.analytics-common.version}</version>
</dependency>
<dependency>
    <groupId>org.wso2.carbon.analytics-common</groupId>
    <artifactId>org.wso2.carbon.databridge.commons.binary</artifactId>
    <version>${carbon.analytics-common.version}</version>
</dependency>

 

...

  1. Load the following sample configurations and properties to define the data agent in the JVM.

    Code Block
    languagexml
    <DataAgentsConfiguration>
        <Agent>
            <Name>Thrift</Name>
            <DataEndpointClass>org.wso2.carbon.databridge.agent.internal.endpoint.thrift.ThriftDataEndpoint</DataEndpointClass>
            <TrustSore>src/main/resources/client-truststore.jks</TrustSore>
            <TrustSorePassword>wso2carbon</TrustSorePassword>
            <QueueSize>32768</QueueSize>
            <BatchSize>200</BatchSize>
            <CorePoolSize>5</CorePoolSize>
            <MaxPoolSize>10</MaxPoolSize>
            <KeepAliveTimeInPool>20</KeepAliveTimeInPool>
            <ReconnectionInterval>30</ReconnectionInterval>
            <MaxTransportPoolSize>250</MaxTransportPoolSize>
            <MaxIdleConnections>250</MaxIdleConnections>
            <EvictionTimePeriod>5500</EvictionTimePeriod>
            <MinIdleTimeInPool>5000</MinIdleTimeInPool>
            <SecureMaxTransportPoolSize>250</SecureMaxTransportPoolSize>
            <SecureMaxIdleConnections>250</SecureMaxIdleConnections>
            <SecureEvictionTimePeriod>5500</SecureEvictionTimePeriod>
            <SecureMinIdleTimeInPool>5000</SecureMinIdleTimeInPool>
        </Agent>
    
        <Agent>
            <Name>Binary</Name>
            <DataEndpointClass>org.wso2.carbon.databridge.agent.internal.endpoint.binary.BinaryDataEndpoint
            </DataEndpointClass>
            <TrustSore>src/main/resources/client-truststore.jks</TrustSore>
            <TrustSorePassword>wso2carbon</TrustSorePassword>
            <QueueSize>32768</QueueSize>
            <BatchSize>200</BatchSize>
            <CorePoolSize>5</CorePoolSize>
            <MaxPoolSize>10</MaxPoolSize>
            <KeepAliveTimeInPool>20</KeepAliveTimeInPool>
            <ReconnectionInterval>30</ReconnectionInterval>
            <MaxTransportPoolSize>250</MaxTransportPoolSize>
            <MaxIdleConnections>250</MaxIdleConnections>
            <EvictionTimePeriod>5500</EvictionTimePeriod>
            <MinIdleTimeInPool>5000</MinIdleTimeInPool>
            <SecureMaxTransportPoolSize>250</SecureMaxTransportPoolSize>
            <SecureMaxIdleConnections>250</SecureMaxIdleConnections>
            <SecureEvictionTimePeriod>5500</SecureEvictionTimePeriod>
            <SecureMinIdleTimeInPool>5000</SecureMinIdleTimeInPool>
        </Agent>
    </DataAgentsConfiguration>
    Tip

    To configure the above parameters in the <CEP_HOME>/repository/conf/data-bridge/data-agent-conf.xml file in order to tune performance, follow the instructions in WSO2 event configuration.

  2. Instantiate the data publisher as follows:  AgentHolder. setConfigPath(“/path/to/data/agent/conf.xml”)
  3. Set trustStore

    Code Block
    languagejava
    File securityFile = new File(<CEP_HOME> + "repository" + File.separator + "resources" + File.separator +"security");
    String trustStore = securityFile.getAbsolutePath();
    System.setProperty("javax.net.ssl.trustStore", trustStore + "" + File.separator + "client-truststore.jks");
    System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");
    Info

    The key also the can be found at https://github.com/wso2/carbon-kernel/tree/master/distribution/kernel/carbon-home/repository/resources/security

  4. Instantiate and use the data publisher using one of the following configurations:

    • DataPublisher dataPublisher = new DataPublisher(url, username, password);
    • DataPublisher dataPublisher = new DataPublisher(receiverURLSet, username, password);

    • DataPublisher dataPublisher = new DataPublisher(receiverURLSet,authURLSet, username, password);  

       

      Info

      For information on the receiverURLSet and authURLSet parameters of the above configuration, see Setting up Multi Receiver and Load Balancing Data Agent. And similarly if you are passing an receiverURLSet as tcp://localhost:7611|tcp://localhost:7612|tcp://localhost:7613, then the corresponding receiverURL authentication URL set will be ssl://localhost:7711|ssl://localhost:7712|ssl://localhost:7713.

      In all the above methods, the default data agent (which is configured as first Agent element in the above configuration) will be used to create the data publishers. If you have configured only the Thrift data agent in the <CEP_HOME>/repository/conf/data-bridge/data-agent-conf.xml file, then this will provide you a Thirft-based data publisher instance.

      However, if you have configured more types of data agents in the <CEP_HOME>/repository/conf/data-bridge/data-agent-conf.xml file (Eg: Binary Agent in the above sample data-agent-conf.xml ), then you can pass an additional property named type, which denotes the type of data publisher that needs to be created. For example, if you have a binary data publisher, then you can pass binary as the type to get the binary data publisher Instance as shown below.

      Code Block
      languagejava
       DataPublisher dataPublisher = new DataPublisher(String type, String receiverURLSet, String authURLSet, String username, String password);  

...