Class MessageQueue

java.lang.Object
java.util.concurrent.SubmissionPublisher<Message>
tv.phantombot.twitch.irc.chat.utils.MessageQueue
All Implemented Interfaces:
AutoCloseable, Flow.Processor<Message,Message>, Flow.Publisher<Message>, Flow.Subscriber<Message>
Direct Known Subclasses:
TwitchSession

public abstract class MessageQueue extends SubmissionPublisher<Message> implements Flow.Processor<Message,Message>
  • Field Details

    • channelName

      protected final String channelName
    • isAllowedToSend

      protected boolean isAllowedToSend
    • nextReminder

      protected Instant nextReminder
    • REMINDER_INTERVAL

      protected static final long REMINDER_INTERVAL
      See Also:
    • subscription

      protected Flow.Subscription subscription
  • Constructor Details

    • MessageQueue

      protected MessageQueue(String channelName)
      Class constructor.
      Parameters:
      channelName -
  • Method Details

    • setAllowSendMessages

      public void setAllowSendMessages(boolean isAllowedToSend)
      Method that sets if we are allowed to send messages.
      Parameters:
      isAllowedToSend -
    • isAllowedToSendMessages

      public boolean isAllowedToSendMessages()
      Method that says if we are allowed to send messages.
      Returns:
      isAllowedToSend
    • say

      public void say(String message)
      Attempts to enqueue a message, timing out after 5 seconds.
      Parameters:
      message -
    • sayNow

      public void sayNow(String message)
      Attempts to enqueue a message until success.
      Parameters:
      message -
    • kill

      public void kill()
      Method that kills this instance.
    • onSubscribe

      public void onSubscribe(Flow.Subscription subscription)
      Specified by:
      onSubscribe in interface Flow.Subscriber<Message>
    • onError

      public void onError(Throwable thrwbl)
      Specified by:
      onError in interface Flow.Subscriber<Message>