public class ReliableMessageListenerAdapter<E> extends Object implements ReliableMessageListener<E>
Constructor and Description |
---|
ReliableMessageListenerAdapter(MessageListener<E> messageListener) |
Modifier and Type | Method and Description |
---|---|
boolean |
isLossTolerant()
Checks if this ReliableMessageListener is able to deal with message loss.
|
boolean |
isTerminal(Throwable failure)
Checks if the ReliableMessageListener should be terminated based on an
exception thrown while calling
MessageListener.onMessage(com.hazelcast.core.Message) . |
void |
onMessage(Message<E> message)
Invoked when a message is received for the added topic.
|
long |
retrieveInitialSequence()
Retrieves the initial sequence from which this ReliableMessageListener
should start.
|
void |
storeSequence(long sequence)
Informs the ReliableMessageListener that it should store the sequence.
|
String |
toString() |
public ReliableMessageListenerAdapter(MessageListener<E> messageListener)
public long retrieveInitialSequence()
ReliableMessageListener
Return -1
if there is no initial sequence and you want to start
from the next published message.
If you intend to create a durable subscriber so you continue from where you stopped the previous time, load the previous sequence and add 1. If you don't add one, then you will be receiving the same message twice.
retrieveInitialSequence
in interface ReliableMessageListener<E>
public void storeSequence(long sequence)
ReliableMessageListener
storeSequence
in interface ReliableMessageListener<E>
sequence
- the sequencepublic boolean isLossTolerant()
ReliableMessageListener
If the ReliableMessageListener is not loss tolerant and the topic detects that there are missing messages, it will terminate the ReliableMessageListener.
isLossTolerant
in interface ReliableMessageListener<E>
true
if the ReliableMessageListener is tolerant towards losing messages.public void onMessage(Message<E> message)
MessageListener
onMessage
in interface MessageListener<E>
message
- the message that is received for the added topicpublic boolean isTerminal(Throwable failure)
ReliableMessageListener
MessageListener.onMessage(com.hazelcast.core.Message)
.isTerminal
in interface ReliableMessageListener<E>
failure
- the exception thrown while calling
MessageListener.onMessage(com.hazelcast.core.Message)
.true
if the ReliableMessageListener should terminate itself,
false
if it should keep on running.Copyright © 2022 Hazelcast, Inc.. All Rights Reserved.