Search in sources :

Example 1 with MessageHeaderDecoder

use of io.zeebe.protocol.clientapi.MessageHeaderDecoder in project zeebe by zeebe-io.

the class ClientApiRule method isMessageOfType.

protected boolean isMessageOfType(DirectBuffer message, int type) {
    final MessageHeaderDecoder headerDecoder = new MessageHeaderDecoder();
    headerDecoder.wrap(message, 0);
    return headerDecoder.templateId() == type;
}
Also used : MessageHeaderDecoder(io.zeebe.protocol.clientapi.MessageHeaderDecoder)

Example 2 with MessageHeaderDecoder

use of io.zeebe.protocol.clientapi.MessageHeaderDecoder in project zeebe by zeebe-io.

the class RequestManager method shouldRetryRequest.

private static boolean shouldRetryRequest(DirectBuffer responseContent) {
    final ErrorResponseHandler errorHandler = new ErrorResponseHandler();
    final MessageHeaderDecoder headerDecoder = new MessageHeaderDecoder();
    headerDecoder.wrap(responseContent, 0);
    if (errorHandler.handlesResponse(headerDecoder)) {
        errorHandler.wrap(responseContent, headerDecoder.encodedLength(), headerDecoder.blockLength(), headerDecoder.version());
        final ErrorCode errorCode = errorHandler.getErrorCode();
        return errorCode == ErrorCode.PARTITION_NOT_FOUND || errorCode == ErrorCode.REQUEST_TIMEOUT;
    } else {
        return false;
    }
}
Also used : MessageHeaderDecoder(io.zeebe.protocol.clientapi.MessageHeaderDecoder) ErrorCode(io.zeebe.protocol.clientapi.ErrorCode) ErrorResponseHandler(io.zeebe.client.task.impl.ErrorResponseHandler)

Aggregations

MessageHeaderDecoder (io.zeebe.protocol.clientapi.MessageHeaderDecoder)2 ErrorResponseHandler (io.zeebe.client.task.impl.ErrorResponseHandler)1 ErrorCode (io.zeebe.protocol.clientapi.ErrorCode)1