Interface MessagePoller

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable, deltix.util.lang.Disposable

    @ParametersAreNonnullByDefault
    public interface MessagePoller
    extends deltix.util.lang.Disposable
    Executes processing of messages from topic. Please note that Disposable.close() method must be called from the same treas as processMessages(int, deltix.qsrv.hf.tickdb.pub.topic.MessageProcessor)
    • Method Detail

      • processMessages

        int processMessages​(int messageCountLimit,
                            @Nonnull
                            MessageProcessor messageProcessor)
        Executes non-blocking message processing. If there are no messages available then this call returns 0 (without blocking).

        IMPORTANT: Don't create a new processor instance for each call. Create it once outside the polling loop.

        Parameters:
        messageCountLimit - maximum number of messages to process during this method call
        messageProcessor - processor for messages.
        Returns:
        number of messages to process.
      • getBufferFillPercentage

        byte getBufferFillPercentage()
        Provides estimate of amount of data in the incoming message buffer.

        Note: value 0 does not necessary mean 0 incoming messages. Don't use this method to check if there messages to process.

        WARNING: This operation is relatively slow. Do not use it for each message. It's a good practice to call this method only once per 100 or 1000 messages.

        Returns:
        number in range from 0 to 100. 0 means that buffer is close to empty and 100 mean that buffer is full.