Java Code Examples for org.wso2.carbon.databridge.commons.StreamDefinition#setDescription()

The following examples show how to use org.wso2.carbon.databridge.commons.StreamDefinition#setDescription() . 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: DASMemberStatusPublisher.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
private static StreamDefinition createStreamDefinition() {
    try {
        // Create stream definition
        StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION);
        streamDefinition.setNickName("Member Lifecycle");
        streamDefinition.setDescription("Member Lifecycle");
        List<Attribute> payloadData = new ArrayList<Attribute>();

        // Set payload definition
        payloadData.add(new Attribute(CloudControllerConstants.TIMESTAMP_COL, AttributeType.LONG));
        payloadData.add(new Attribute(CloudControllerConstants.APPLICATION_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.CLUSTER_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.CLUSTER_ALIAS_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.CLUSTER_INSTANCE_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.SERVICE_NAME_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.NETWORK_PARTITION_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.PARTITION_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.MEMBER_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.MEMBER_STATUS_COL, AttributeType.STRING));
        streamDefinition.setPayloadData(payloadData);
        return streamDefinition;
    } catch (Exception e) {
        throw new RuntimeException("Could not create stream definition", e);
    }
}
 
Example 2
Source File: WSO2CEPHealthStatisticsPublisher.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
private static StreamDefinition createStreamDefinition() {
    try {
        // Create stream definition
        StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION);
        streamDefinition.setNickName("agent health stats");
        streamDefinition.setDescription("agent health stats");

        // Set payload definition
        List<Attribute> payloadData = new ArrayList<Attribute>();
        payloadData.add(new Attribute("cluster_id", AttributeType.STRING));
        payloadData.add(new Attribute("cluster_instance_id", AttributeType.STRING));
        payloadData.add(new Attribute("network_partition_id", AttributeType.STRING));
        payloadData.add(new Attribute("member_id", AttributeType.STRING));
        payloadData.add(new Attribute("partition_id", AttributeType.STRING));
        payloadData.add(new Attribute("health_description", AttributeType.STRING));
        payloadData.add(new Attribute("value", AttributeType.DOUBLE));

        streamDefinition.setPayloadData(payloadData);
        return streamDefinition;
    } catch (Exception e) {
        throw new RuntimeException("Could not create stream definition", e);
    }
}
 
Example 3
Source File: WSO2CEPInFlightRequestPublisher.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
private static StreamDefinition createStreamDefinition() {
    try {
        // Create stream definition
        StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION);
        streamDefinition.setNickName("lb stats");
        streamDefinition.setDescription("lb stats");
        List<Attribute> payloadData = new ArrayList<Attribute>();

        // Set payload definition
        payloadData.add(new Attribute("cluster_id", AttributeType.STRING));
        payloadData.add(new Attribute("cluster_instance_id", AttributeType.STRING));
        payloadData.add(new Attribute("network_partition_id", AttributeType.STRING));
        payloadData.add(new Attribute("in_flight_request_count", AttributeType.DOUBLE));
        streamDefinition.setPayloadData(payloadData);
        return streamDefinition;
    } catch (Exception e) {
        throw new RuntimeException("Could not create stream definition", e);
    }
}
 
Example 4
Source File: CartridgeSubscriptionDataPublisher.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
private static StreamDefinition initializeStream() throws Exception {
    streamDefinition = new StreamDefinition(CartridgeConstants.STRATOS_MANAGER_EVENT_STREAM,
            stratosManagerEventStreamVersion);
    streamDefinition.setNickName("stratos.manager");
    streamDefinition.setDescription("Tenant Subscription Data");
    // Payload definition
    List<Attribute> payloadData = new ArrayList<Attribute>();
    payloadData.add(new Attribute(CartridgeConstants.TENANT_ID_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.ADMIN_USER_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.CARTRIDGE_ALIAS_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.CARTRIDGE_TYPE_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.REPOSITORY_URL_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.MULTI_TENANT_BEHAVIOR_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.AUTO_SCALE_POLICY_COL, AttributeType.STRING));
    payloadData
            .add(new Attribute(CartridgeConstants.DEPLOYMENT_POLICY_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.CLUSTER_ID_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.HOST_NAME_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.MAPPED_DOMAIN_COL, AttributeType.STRING));
    payloadData.add(new Attribute(CartridgeConstants.ACTION_COL, AttributeType.STRING));
    streamDefinition.setPayloadData(payloadData);
    return streamDefinition;
}
 
Example 5
Source File: DASApplicationSignUpDataPublisher.java    From attic-stratos with Apache License 2.0 6 votes vote down vote up
private static StreamDefinition getStreamDefinition() {
    try {
        // Create stream definition
        StreamDefinition streamDefinition = new StreamDefinition(DATASTREAM_NAME, VERSION);
        streamDefinition.setNickName(DATASTREAM_NICKNAME);
        streamDefinition.setDescription(DATASTREAM_DESC);
        List<Attribute> payloadData = new ArrayList<Attribute>();

        // Set payload definition
        payloadData.add(new Attribute(APPLICATION_ID, AttributeType.STRING));
        payloadData.add(new Attribute(TENANT_ID, AttributeType.INT));
        payloadData.add(new Attribute(TENANT_DOMAIN, AttributeType.STRING));
        payloadData.add(new Attribute(START_TIME, AttributeType.LONG));
        payloadData.add(new Attribute(END_TIME, AttributeType.LONG));
        payloadData.add(new Attribute(DURATION, AttributeType.LONG));

        streamDefinition.setPayloadData(payloadData);
        return streamDefinition;
    } catch (Exception e) {
        throw new RuntimeException("Could not create stream definition", e);
    }
}
 
Example 6
Source File: DASScalingDecisionPublisher.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
private static StreamDefinition createStreamDefinition() {
    try {
        // Create stream definition
        StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION);
        streamDefinition.setNickName("Scaling Decision");
        streamDefinition.setDescription("Scaling Decision");
        List<Attribute> payloadData = new ArrayList<Attribute>();

        // Set payload definition
        payloadData.add(new Attribute(AutoscalerConstants.TIMESTAMP, AttributeType.LONG));
        payloadData.add(new Attribute(AutoscalerConstants.SCALING_DECISION_ID, AttributeType.STRING));
        payloadData.add(new Attribute(AutoscalerConstants.CLUSTER_ID, AttributeType.STRING));
        payloadData.add(new Attribute(AutoscalerConstants.MIN_INSTANCE_COUNT, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.MAX_INSTANCE_COUNT, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.RIF_PREDICTED, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.RIF_THRESHOLD, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.RIF_REQUIRED_INSTANCES, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.MC_PREDICTED, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.MC_THRESHOLD, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.MC_REQUIRED_INSTANCES, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.LA_PREDICTED, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.LA_THRESHOLD, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.LA_REQUIRED_INSTANCES, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.REQUIRED_INSTANCE_COUNT, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.ACTIVE_INSTANCE_COUNT, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.ADDITIONAL_INSTANCE_COUNT, AttributeType.INT));
        payloadData.add(new Attribute(AutoscalerConstants.SCALING_REASON, AttributeType.STRING));
        streamDefinition.setPayloadData(payloadData);
        return streamDefinition;
    } catch (Exception e) {
        throw new RuntimeException("Could not create stream definition", e);
    }
}
 
Example 7
Source File: DASMemberInformationPublisher.java    From attic-stratos with Apache License 2.0 5 votes vote down vote up
private static StreamDefinition createStreamDefinition() {
    try {
        // Create stream definition
        StreamDefinition streamDefinition = new StreamDefinition(DATA_STREAM_NAME, VERSION);
        streamDefinition.setNickName("Member Information");
        streamDefinition.setDescription("Member Information");
        List<Attribute> payloadData = new ArrayList<Attribute>();

        // Set payload definition
        payloadData.add(new Attribute(CloudControllerConstants.MEMBER_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.INSTANCE_TYPE_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.SCALING_DECISION_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.IS_MULTI_TENANT_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.PRIV_IP_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.PUB_IP_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.ALLOCATED_IP_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.HOST_NAME_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.HYPERVISOR_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.CPU_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.RAM_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.IMAGE_ID_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.LOGIN_PORT_COL, AttributeType.INT));
        payloadData.add(new Attribute(CloudControllerConstants.OS_NAME_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.OS_VERSION_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.OS_ARCH_COL, AttributeType.STRING));
        payloadData.add(new Attribute(CloudControllerConstants.OS_BIT_COL, AttributeType.BOOL));
        streamDefinition.setPayloadData(payloadData);
        return streamDefinition;
    } catch (Exception e) {
        throw new RuntimeException("Could not create stream definition", e);
    }
}
 
Example 8
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);
    }