Search in sources :

Example 1 with InsightEventFormatException

use of com.datastax.dse.driver.internal.core.insights.exceptions.InsightEventFormatException in project java-driver by datastax.

the class InsightsClient method createStartupMessage.

@VisibleForTesting
String createStartupMessage() {
    InsightMetadata insightMetadata = createMetadata(STARTUP_MESSAGE_NAME, STARTUP_VERSION_1_ID);
    InsightsStartupData data = createStartupData();
    try {
        return OBJECT_MAPPER.writeValueAsString(new Insight<>(insightMetadata, data));
    } catch (JsonProcessingException e) {
        throw new InsightEventFormatException("Problem when creating: " + STARTUP_MESSAGE_NAME, e);
    }
}
Also used : InsightEventFormatException(com.datastax.dse.driver.internal.core.insights.exceptions.InsightEventFormatException) InsightsStartupData(com.datastax.dse.driver.internal.core.insights.schema.InsightsStartupData) InsightMetadata(com.datastax.dse.driver.internal.core.insights.schema.InsightMetadata) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) VisibleForTesting(com.datastax.oss.driver.shaded.guava.common.annotations.VisibleForTesting)

Example 2 with InsightEventFormatException

use of com.datastax.dse.driver.internal.core.insights.exceptions.InsightEventFormatException in project java-driver by datastax.

the class InsightsClient method createStatusMessage.

@VisibleForTesting
String createStatusMessage() {
    InsightMetadata insightMetadata = createMetadata(STATUS_MESSAGE_NAME, STATUS_VERSION_1_ID);
    InsightsStatusData data = createStatusData();
    try {
        return OBJECT_MAPPER.writeValueAsString(new Insight<>(insightMetadata, data));
    } catch (JsonProcessingException e) {
        throw new InsightEventFormatException("Problem when creating: " + STATUS_MESSAGE_NAME, e);
    }
}
Also used : InsightEventFormatException(com.datastax.dse.driver.internal.core.insights.exceptions.InsightEventFormatException) InsightsStatusData(com.datastax.dse.driver.internal.core.insights.schema.InsightsStatusData) InsightMetadata(com.datastax.dse.driver.internal.core.insights.schema.InsightMetadata) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) VisibleForTesting(com.datastax.oss.driver.shaded.guava.common.annotations.VisibleForTesting)

Aggregations

InsightEventFormatException (com.datastax.dse.driver.internal.core.insights.exceptions.InsightEventFormatException)2 InsightMetadata (com.datastax.dse.driver.internal.core.insights.schema.InsightMetadata)2 VisibleForTesting (com.datastax.oss.driver.shaded.guava.common.annotations.VisibleForTesting)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 InsightsStartupData (com.datastax.dse.driver.internal.core.insights.schema.InsightsStartupData)1 InsightsStatusData (com.datastax.dse.driver.internal.core.insights.schema.InsightsStatusData)1