Class 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 Summary
FieldsModifier and TypeFieldDescriptionprotected final Stringprotected booleanprotected Instantprotected static final longprotected Flow.Subscription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanMethod that says if we are allowed to send messages.voidkill()Method that kills this instance.voidvoidonSubscribe(Flow.Subscription subscription) voidAttempts to enqueue a message, timing out after 5 seconds.voidAttempts to enqueue a message until success.voidsetAllowSendMessages(boolean isAllowedToSend) Method that sets if we are allowed to send messages.Methods inherited from class java.util.concurrent.SubmissionPublisher
close, closeExceptionally, consume, estimateMaximumLag, estimateMinimumDemand, getClosedException, getExecutor, getMaxBufferCapacity, getNumberOfSubscribers, getSubscribers, hasSubscribers, isClosed, isSubscribed, offer, offer, submit, subscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.concurrent.Flow.Publisher
subscribeMethods inherited from interface java.util.concurrent.Flow.Subscriber
onComplete, onNext
-
Field Details
-
channelName
-
isAllowedToSend
protected boolean isAllowedToSend -
nextReminder
-
REMINDER_INTERVAL
protected static final long REMINDER_INTERVAL- See Also:
-
subscription
-
-
Constructor Details
-
MessageQueue
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
Attempts to enqueue a message, timing out after 5 seconds.- Parameters:
message-
-
sayNow
Attempts to enqueue a message until success.- Parameters:
message-
-
kill
public void kill()Method that kills this instance. -
onSubscribe
- Specified by:
onSubscribein interfaceFlow.Subscriber<Message>
-
onError
- Specified by:
onErrorin interfaceFlow.Subscriber<Message>
-