Search in sources :

Example 1 with HeartbeatRequest

use of org.apache.kafka.common.requests.HeartbeatRequest in project kafka by apache.

the class AbstractCoordinatorTest method prepareFirstHeartbeat.

private AtomicBoolean prepareFirstHeartbeat() {
    final AtomicBoolean heartbeatReceived = new AtomicBoolean(false);
    mockClient.prepareResponse(new MockClient.RequestMatcher() {

        @Override
        public boolean matches(AbstractRequest body) {
            boolean isHeartbeatRequest = body instanceof HeartbeatRequest;
            if (isHeartbeatRequest)
                heartbeatReceived.set(true);
            return isHeartbeatRequest;
        }
    }, heartbeatResponse(Errors.UNKNOWN));
    return heartbeatReceived;
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AbstractRequest(org.apache.kafka.common.requests.AbstractRequest) MockClient(org.apache.kafka.clients.MockClient) HeartbeatRequest(org.apache.kafka.common.requests.HeartbeatRequest)

Aggregations

AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 MockClient (org.apache.kafka.clients.MockClient)1 AbstractRequest (org.apache.kafka.common.requests.AbstractRequest)1 HeartbeatRequest (org.apache.kafka.common.requests.HeartbeatRequest)1