Search in sources :

Example 1 with AnalyticsStreamConfiguration

use of org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsStreamConfiguration in project carbon-business-process by wso2.

the class AnalyticsPublisherExtensionOperation method getEventStream.

private AnalyticsStreamConfiguration getEventStream(int tenantId, String analyticsServerProfileName, String streamName, String streamVersion) {
    AnalyticsServerProfile analyticsServerProfile = getAnalyticsServerProfile(tenantId, analyticsServerProfileName);
    if (null == analyticsServerProfile) {
        String errMsg = "AnalyticsServerProfile not found for stream name and version " + streamName + " " + streamVersion;
        log.error(errMsg);
        return null;
    }
    return analyticsServerProfile.getAnalyticsStreamConfiguration(streamName, streamVersion);
}
Also used : AnalyticsServerProfile(org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile)

Example 2 with AnalyticsStreamConfiguration

use of org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsStreamConfiguration in project carbon-business-process by wso2.

the class AnalyticsPublisherExtensionOperation method runSync.

@Override
protected void runSync(ExtensionContext extensionContext, Element element) throws FaultException {
    String analyticsServerProfileName = element.getAttribute("analyticsServerProfile");
    String streamName = element.getAttribute(AnalyticsPublisherConstants.STREAM_NAME_ATTR);
    String streamVersion = element.getAttribute(AnalyticsPublisherConstants.STREAM_VERSION);
    Integer tenantId = getTenantId(extensionContext);
    AnalyticsStreamConfiguration stream = getEventStream(tenantId, analyticsServerProfileName, streamName, streamVersion);
    if (stream == null) {
        log.debug("Stream configuration is invalid");
        return;
    }
    DataPublisher dataPublisher = getDataPublisher(extensionContext, tenantId, analyticsServerProfileName);
    if (dataPublisher == null) {
        String msg = "Error while creating data publisher";
        handleException(msg);
    }
    String streamId = DataBridgeCommonsUtils.generateStreamId(stream.getName(), stream.getVersion());
    dataPublisher.tryPublish(streamId, createMetadata(stream, extensionContext, element), createCorrelationData(stream, extensionContext, element), createPayloadData(stream, extensionContext, element));
}
Also used : DataPublisher(org.wso2.carbon.databridge.agent.DataPublisher) AnalyticsStreamConfiguration(org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsStreamConfiguration)

Aggregations

AnalyticsServerProfile (org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsServerProfile)1 AnalyticsStreamConfiguration (org.wso2.carbon.bpel.core.ode.integration.config.analytics.AnalyticsStreamConfiguration)1 DataPublisher (org.wso2.carbon.databridge.agent.DataPublisher)1