@Test public void shouldNotifySessionOfMissingMsgSeqNum() { final UnsafeBuffer buffer = bufferOf( "8=FIX.4.4\00135=B\00149=abc\00152=00000101-00:00:00.000\00156=das\001"); parser.onMessage(buffer, 0, buffer.capacity(), 'B', POSITION); verify(mockSession).onMessage( eq(MISSING_INT), any(), anyInt(), anyLong(), anyLong(), eq(false), eq(false), eq(POSITION)); }
public Action onMessage( final DirectBuffer buffer, final int offset, final int length, final long messageType, final long position) { asciiBuffer.wrap(buffer); final Action action; try { if (messageType == LOGON_MESSAGE_TYPE) { action = onLogon(offset, length, position); } else if (messageType == LOGOUT_MESSAGE_TYPE) { action = onLogout(offset, length, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { action = onHeartbeat(offset, length, position); } else if (messageType == REJECT_MESSAGE_TYPE) { action = onReject(offset, length, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { action = onTestRequest(offset, length, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { action = onSequenceReset(offset, length, position); } else if (messageType == RESEND_REQUEST_MESSAGE_TYPE) { action = onResendRequest(offset, length, position); } else { action = onAnyOtherMessage(offset, length, position); } session.updateLastMessageProcessed(); return action; } catch (final MalformedTagFormatException e) { return rejectAndHandleExceptionalMessage(e, messageType, e.refTagId(), position); } catch (final AsciiNumberFormatException e) { if (e.getMessage().contains("'^' is not a valid digit")) { return CONTINUE; } else { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } catch (final Exception e) { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } }
SessionParser { public Action onMessage( final DirectBuffer buffer, final int offset, final int length, final long messageType, final long position) { asciiBuffer.wrap(buffer); final Action action; try { if (messageType == LOGON_MESSAGE_TYPE) { action = onLogon(offset, length, position); } else if (messageType == LOGOUT_MESSAGE_TYPE) { action = onLogout(offset, length, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { action = onHeartbeat(offset, length, position); } else if (messageType == REJECT_MESSAGE_TYPE) { action = onReject(offset, length, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { action = onTestRequest(offset, length, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { action = onSequenceReset(offset, length, position); } else if (messageType == RESEND_REQUEST_MESSAGE_TYPE) { action = onResendRequest(offset, length, position); } else { action = onAnyOtherMessage(offset, length, position); } session.updateLastMessageProcessed(); return action; } catch (final MalformedTagFormatException e) { return rejectAndHandleExceptionalMessage(e, messageType, e.refTagId(), position); } catch (final AsciiNumberFormatException e) { if (e.getMessage().contains("'^' is not a valid digit")) { return CONTINUE; } else { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } catch (final Exception e) { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } }
SessionParser { public Action onMessage( final DirectBuffer buffer, final int offset, final int length, final long messageType, final long position) { asciiBuffer.wrap(buffer); final Action action; try { if (messageType == LOGON_MESSAGE_TYPE) { action = onLogon(offset, length, position); } else if (messageType == LOGOUT_MESSAGE_TYPE) { action = onLogout(offset, length, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { action = onHeartbeat(offset, length, position); } else if (messageType == REJECT_MESSAGE_TYPE) { action = onReject(offset, length, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { action = onTestRequest(offset, length, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { action = onSequenceReset(offset, length, position); } else if (messageType == RESEND_REQUEST_MESSAGE_TYPE) { action = onResendRequest(offset, length, position); } else { action = onAnyOtherMessage(offset, length, position); } session.updateLastMessageProcessed(); return action; } catch (final MalformedTagFormatException e) { return rejectAndHandleExceptionalMessage(e, messageType, e.refTagId(), position); } catch (final AsciiNumberFormatException e) { if (e.getMessage().contains("'^' is not a valid digit")) { return CONTINUE; } else { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } catch (final Exception e) { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } SessionParser(
        final Session session,
        final MessageValidationStrategy validationStrategy,
        final ErrorHandler errorHandler,
        final boolean validateCompIdsOnEveryMessage,
        final boolean validateTimeStrictly,
        final OnMessageInfo messageInfo,
        final SessionIdStrategy sessionIdStrategy); }
SessionParser { public Action onMessage( final DirectBuffer buffer, final int offset, final int length, final long messageType, final long position) { asciiBuffer.wrap(buffer); final Action action; try { if (messageType == LOGON_MESSAGE_TYPE) { action = onLogon(offset, length, position); } else if (messageType == LOGOUT_MESSAGE_TYPE) { action = onLogout(offset, length, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { action = onHeartbeat(offset, length, position); } else if (messageType == REJECT_MESSAGE_TYPE) { action = onReject(offset, length, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { action = onTestRequest(offset, length, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { action = onSequenceReset(offset, length, position); } else if (messageType == RESEND_REQUEST_MESSAGE_TYPE) { action = onResendRequest(offset, length, position); } else { action = onAnyOtherMessage(offset, length, position); } session.updateLastMessageProcessed(); return action; } catch (final MalformedTagFormatException e) { return rejectAndHandleExceptionalMessage(e, messageType, e.refTagId(), position); } catch (final AsciiNumberFormatException e) { if (e.getMessage().contains("'^' is not a valid digit")) { return CONTINUE; } else { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } catch (final Exception e) { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } SessionParser(
        final Session session,
        final MessageValidationStrategy validationStrategy,
        final ErrorHandler errorHandler,
        final boolean validateCompIdsOnEveryMessage,
        final boolean validateTimeStrictly,
        final OnMessageInfo messageInfo,
        final SessionIdStrategy sessionIdStrategy); void fixDictionary(final FixDictionary fixDictionary); static String username(final AbstractLogonDecoder logon); static String password(final AbstractLogonDecoder logon); Action onMessage(
        final DirectBuffer buffer,
        final int offset,
        final int length,
        final long messageType,
        final long position); Session session(); void sequenceIndex(final int sequenceIndex); void sessionKey(final CompositeKey sessionKey); }
SessionParser { public Action onMessage( final DirectBuffer buffer, final int offset, final int length, final long messageType, final long position) { asciiBuffer.wrap(buffer); final Action action; try { if (messageType == LOGON_MESSAGE_TYPE) { action = onLogon(offset, length, position); } else if (messageType == LOGOUT_MESSAGE_TYPE) { action = onLogout(offset, length, position); } else if (messageType == HEARTBEAT_MESSAGE_TYPE) { action = onHeartbeat(offset, length, position); } else if (messageType == REJECT_MESSAGE_TYPE) { action = onReject(offset, length, position); } else if (messageType == TEST_REQUEST_MESSAGE_TYPE) { action = onTestRequest(offset, length, position); } else if (messageType == SEQUENCE_RESET_MESSAGE_TYPE) { action = onSequenceReset(offset, length, position); } else if (messageType == RESEND_REQUEST_MESSAGE_TYPE) { action = onResendRequest(offset, length, position); } else { action = onAnyOtherMessage(offset, length, position); } session.updateLastMessageProcessed(); return action; } catch (final MalformedTagFormatException e) { return rejectAndHandleExceptionalMessage(e, messageType, e.refTagId(), position); } catch (final AsciiNumberFormatException e) { if (e.getMessage().contains("'^' is not a valid digit")) { return CONTINUE; } else { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } catch (final Exception e) { return rejectAndHandleExceptionalMessage(e, messageType, MISSING_INT, position); } } SessionParser(
        final Session session,
        final MessageValidationStrategy validationStrategy,
        final ErrorHandler errorHandler,
        final boolean validateCompIdsOnEveryMessage,
        final boolean validateTimeStrictly,
        final OnMessageInfo messageInfo,
        final SessionIdStrategy sessionIdStrategy); void fixDictionary(final FixDictionary fixDictionary); static String username(final AbstractLogonDecoder logon); static String password(final AbstractLogonDecoder logon); Action onMessage(
        final DirectBuffer buffer,
        final int offset,
        final int length,
        final long messageType,
        final long position); Session session(); void sequenceIndex(final int sequenceIndex); void sessionKey(final CompositeKey sessionKey);  }