Class MessagingListenActor<T>
- java.lang.Object
- 
- org.apache.ignite.messaging.MessagingListenActor<T>
 
- 
- All Implemented Interfaces:
- Serializable,- IgniteBiPredicate<UUID,T>
 
 public abstract class MessagingListenActor<T> extends Object implements IgniteBiPredicate<UUID,T> Convenience actor-base adapter forIgniteMessaging.localListen(Object, IgniteBiPredicate)method.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description MessagingListenActor()
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanapply(UUID nodeId, T rcvMsg)Predicate body.protected Igniteignite()Gets grid instance associated with this actor.protected voidonError(Throwable e)This method is called in case when methodreceive(UUID, Object)threw an exception.protected abstract voidreceive(UUID nodeId, T rcvMsg)This method receives the message.protected voidrespond(@Nullable Object respMsg)Responds to the original sender node with given message and continues to listen for the new messages.protected voidrespond(UUID id, @Nullable Object respMsg)Responds to the provided node with given message and continues to listen for the new messages.protected voidskip()Skips current message and continues to listen for new message.protected voidstop()This method instructs underlying implementation to stop receiving new messages and unregister the message listener.protected voidstop(@Nullable Object respMsg)This method sends the response message to the original sender node and instructs underlying implementation to stop receiving new messages and unregister the message listener.StringtoString()- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface org.apache.ignite.lang.IgniteBiPredicateand
 
- 
 
- 
- 
- 
Method Detail- 
igniteprotected final Ignite ignite() Gets grid instance associated with this actor.- Returns:
- Grid instance associated with this actor.
 
 - 
applypublic final boolean apply(UUID nodeId, T rcvMsg) Predicate body.- Specified by:
- applyin interface- IgniteBiPredicate<UUID,T>
- Parameters:
- nodeId- First parameter.
- rcvMsg- Second parameter.
- Returns:
- Return value.
 
 - 
onErrorprotected void onError(Throwable e) This method is called in case when methodreceive(UUID, Object)threw an exception. Insides of this method the implementation should call any of therespond,stoporskipmethods. If overriding method does nothing - than return value of methodreceive(UUID, Object)is undefined.Default implementation simply calls method stop().- Parameters:
- e- Exception thrown from method- receive(UUID, Object).
 
 - 
receiveprotected abstract void receive(UUID nodeId, T rcvMsg) throws Throwable This method receives the message. This is the only method that subclass needs to override. Insides of this method the implementation should call any of therespond,stoporskipmethods. Note that if none of these methods are called - listener will continue listen for the new messages.- Parameters:
- nodeId- ID of the sender node.
- rcvMsg- Received message.
- Throws:
- Throwable- Thrown in case of any errors. Method- onError(Throwable)} will be called right before returning from this method.
 
 - 
stopprotected final void stop() This method instructs underlying implementation to stop receiving new messages and unregister the message listener.Note that subclasses can call any of respond,stoporskipmethods any number of times. Only the last executed method will determine whether or not the implementation will continue listen for the new messages.
 - 
stopprotected final void stop(@Nullable @Nullable Object respMsg) throws IgniteExceptionThis method sends the response message to the original sender node and instructs underlying implementation to stop receiving new messages and unregister the message listener.Note that subclasses can call any of respond,stoporskipmethods any number of times. Only the last executed method will determine whether or not the implementation will continue listen for the new messages.- Parameters:
- respMsg- Optional response message. If not- null- it will be sent to the original sender node.
- Throws:
- IgniteException- Thrown in case of any errors.
 
 - 
skipprotected final void skip() Skips current message and continues to listen for new message. This method simply callsrespond(null).Note that subclasses can call any of respond,stoporskipmethods any number of times. Only the last executed method will determine whether or not the implementation will continue listen for the new messages.
 - 
respondprotected final void respond(@Nullable @Nullable Object respMsg) throws IgniteExceptionResponds to the original sender node with given message and continues to listen for the new messages.Note that subclasses can call any of respond,stoporskipmethods any number of times. Only the last executed method will determine whether or not the implementation will continue listen for the new messages.- Parameters:
- respMsg- Optional response message. If not- null- it will be sent to the original sender node.
- Throws:
- IgniteException- Thrown in case of any errors.
 
 - 
respondprotected final void respond(UUID id, @Nullable @Nullable Object respMsg) throws IgniteException Responds to the provided node with given message and continues to listen for the new messages.Note that subclasses can call any of respond,stoporskipmethods any number of times. Only the last executed method will determine whether or not the implementation will continue listen for the new messages.- Parameters:
- id- ID of the node to send the message to, if any.
- respMsg- Optional response message. If not- null- it will be sent to the original sender node.
- Throws:
- IgniteException- Thrown in case of any errors.
 
 
- 
 
-