...
Load the following sample configurations and properties to define the data agent in the JVM.
Code Block language xml <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>10000</BatchSize> <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>10000</BatchSize> <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.- Instantiate the data publisher as follows:
AgentHolder. setConfigPath(“/path/to/data/agent/conf.xml”)
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
andauthURLSet
parameters of the above configuration, see /wiki/spaces/PS/pages/10519892 .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 namedtype
, which denotes the type of data publisher that needs to be created. For example, if you have a binary data publisher, then you can passbinary
as the type to get the binary data publisher Instance as shown below.Code Block language java DataPublisher dataPublisher = new DataPublisher(String type, String receiverURLSet, String authURLSet, String username, String password);
Data publisher sample
Tip |
---|
As a prerequisite for this sample, you need to define the streams in the receiver server (WSO2 DAS/CEP). For information on defining event streams, see Working with Event Streams. |
...