Search in sources :

Example 1 with SubscriptionInfoData

use of org.apache.kafka.streams.internals.generated.SubscriptionInfoData in project kafka by apache.

the class SubscriptionInfo method decode.

/**
 * @throws TaskAssignmentException if method fails to decode the data
 */
public static SubscriptionInfo decode(final ByteBuffer data) {
    data.rewind();
    final int version = data.getInt();
    if (version > LATEST_SUPPORTED_VERSION) {
        // in this special case, we only rely on the version and latest version,
        // 
        final int latestSupportedVersion = data.getInt();
        final SubscriptionInfoData subscriptionInfoData = new SubscriptionInfoData();
        subscriptionInfoData.setVersion(version);
        subscriptionInfoData.setLatestSupportedVersion(latestSupportedVersion);
        LOG.info("Unable to decode subscription data: used version: {}; latest supported version: {}", version, latestSupportedVersion);
        return new SubscriptionInfo(subscriptionInfoData);
    } else {
        data.rewind();
        final ByteBufferAccessor accessor = new ByteBufferAccessor(data);
        final SubscriptionInfoData subscriptionInfoData = new SubscriptionInfoData(accessor, (short) version);
        return new SubscriptionInfo(subscriptionInfoData);
    }
}
Also used : SubscriptionInfoData(org.apache.kafka.streams.internals.generated.SubscriptionInfoData) ByteBufferAccessor(org.apache.kafka.common.protocol.ByteBufferAccessor)

Aggregations

ByteBufferAccessor (org.apache.kafka.common.protocol.ByteBufferAccessor)1 SubscriptionInfoData (org.apache.kafka.streams.internals.generated.SubscriptionInfoData)1