org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException Java Examples

The following examples show how to use org.wso2.carbon.databridge.commons.exception.MalformedStreamDefinitionException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Wso2EventClient.java    From product-cep with Apache License 2.0 6 votes vote down vote up
public static void publish(String protocol, String host, String port, String username, String password,
        String streamId,String dataFileName, String testCaseFolderName, StreamDefinition streamDefinition,
        int events, int delay) throws MalformedStreamDefinitionException,
        StreamDefinitionException, DifferentStreamDefinitionAlreadyDefinedException,
        MalformedURLException, NoStreamDefinitionExistException, AuthenticationException,
        TransportException, SocketException, DataEndpointAgentConfigurationException, DataEndpointException,
        DataEndpointAuthenticationException, DataEndpointConfigurationException {

    String relativeFilePath = getTestDataFileLocation(testCaseFolderName, dataFileName);

    KeyStoreUtil.setTrustStoreParams();
    //create data publisher
    DataPublisher dataPublisher = new DataPublisher(protocol, "tcp://" + host + ":" + port, null, username,
            password);

    //Publish event for a valid stream
    publishEvents(dataPublisher, streamDefinition, relativeFilePath, events, delay);
    dataPublisher.shutdown();

}
 
Example #2
Source File: ThriftTestServer.java    From attic-stratos with Apache License 2.0 4 votes vote down vote up
public void addStreamDefinition(String streamDefinitionStr, int tenantId)
        throws StreamDefinitionStoreException, MalformedStreamDefinitionException {
    StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr);
    getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId);
}
 
Example #3
Source File: ThriftTestServer.java    From attic-stratos with Apache License 2.0 4 votes vote down vote up
public void addStreamDefinition(String streamDefinitionStr, int tenantId)
        throws StreamDefinitionStoreException, MalformedStreamDefinitionException {
    StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr);
    getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId);
}
 
Example #4
Source File: LogPublisherManager.java    From attic-stratos with Apache License 2.0 4 votes vote down vote up
public void init(DataPublisherConfiguration dataPublisherConfig) throws DataPublisherException {

        this.dataPublisherConfig = dataPublisherConfig;

        List<Integer> ports = new ArrayList<Integer>();
        ports.add(Integer.parseInt(dataPublisherConfig.getMonitoringServerPort()));
        ports.add(Integer.parseInt(dataPublisherConfig.getMonitoringServerSecurePort()));

        // wait till monitoring server ports are active
        CartridgeAgentUtils.waitUntilPortsActive(dataPublisherConfig.getMonitoringServerIp(), ports);
        if (!CartridgeAgentUtils.checkPortsActive(dataPublisherConfig.getMonitoringServerIp(), ports)) {
            throw new DataPublisherException("Monitoring server not active, data publishing is aborted");
        }

        // stream definition identifier = {log.publisher.<cluster id>}
        try {
            streamDefinition = new StreamDefinition(Constants.LOG_PUBLISHER_STREAM_PREFIX + getValidTenantId(CartridgeAgentConfiguration.getInstance().getTenantId()) + "." + getAlias(CartridgeAgentConfiguration.getInstance().getClusterId()) + "." + getCurrentDate(),
                    Constants.LOG_PUBLISHER_STREAM_VERSION);

        } catch (MalformedStreamDefinitionException e) {
            throw new RuntimeException(e);
        }

        streamDefinition.setDescription("Apache Stratos Instance Log Publisher");

        List<Attribute> metaDataDefinition = new ArrayList<Attribute>();
        metaDataDefinition.add(new Attribute(Constants.MEMBER_ID, AttributeType.STRING));

        List<Attribute> payloadDataDefinition = new ArrayList<Attribute>();
        payloadDataDefinition.add(new Attribute(Constants.TENANT_ID, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.SERVER_NAME, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.APP_NAME, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.LOG_TIME, AttributeType.LONG));
        payloadDataDefinition.add(new Attribute(Constants.PRIORITY, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.MESSAGE, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.LOGGER, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.IP, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.INSTANCE, AttributeType.STRING));
        payloadDataDefinition.add(new Attribute(Constants.STACKTRACE, AttributeType.STRING));

        streamDefinition.setMetaData(metaDataDefinition);
        streamDefinition.setPayloadData(payloadDataDefinition);
    }
 
Example #5
Source File: ThriftStatisticsPublisherTest.java    From attic-stratos with Apache License 2.0 4 votes vote down vote up
@Before
public void setUp() throws MalformedStreamDefinitionException {
    URL configFileUrl = ThriftClientConfigParserTest.class.getResource("/thrift-client-config.xml");
    System.setProperty(ThriftClientConfig.THRIFT_CLIENT_CONFIG_FILE_PATH, configFileUrl.getPath());
    streamDefinition = new StreamDefinition("Test", "1.0.0");
}
 
Example #6
Source File: ThriftTestServer.java    From product-private-paas with Apache License 2.0 4 votes vote down vote up
public void addStreamDefinition(String streamDefinitionStr, int tenantId)
        throws StreamDefinitionStoreException, MalformedStreamDefinitionException {
    StreamDefinition streamDefinition = EventDefinitionConverterUtils.convertFromJson(streamDefinitionStr);
    getStreamDefinitionStore().saveStreamDefinitionToStore(streamDefinition, tenantId);
}