com.kolibrifx.plovercrest.server.internal.protocol.SubscriberLastValidTimestampEvent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of plovercrest-server Show documentation
Show all versions of plovercrest-server Show documentation
Plovercrest server library.
The newest version!
/*
* Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
*/
package com.kolibrifx.plovercrest.server.internal.protocol;
import java.nio.ByteBuffer;
import com.kolibrifx.plovercrest.client.internal.remote.RemoteResponse;
public class SubscriberLastValidTimestampEvent extends StandaloneSubscriberEvent {
private final long entryIndex;
private final long lastValidTimestamp;
public SubscriberLastValidTimestampEvent(final int subscriptionId, final long entryIndex, final long lastValidTimestamp) {
super(subscriptionId);
this.entryIndex = entryIndex;
this.lastValidTimestamp = lastValidTimestamp;
}
@Override
ByteBuffer serialize() {
final ByteBuffer tmpBuffer = ByteBuffer.allocate(24);
tmpBuffer.putInt(RemoteResponse.SUBSCRIBE_LAST_VALID_TIMESTAMP.getTag());
tmpBuffer.putInt(subscriptionId);
tmpBuffer.putLong(entryIndex);
tmpBuffer.putLong(lastValidTimestamp);
return tmpBuffer;
}
}