Class SimpleInboundHandler<I,E,A extends Address>

All Implemented Interfaces:
Handler
Direct Known Subclasses:
ApplicationMessage2ObjectHolderHandler, GroupsClientHandler, GroupsManagerHandler, SimpleDuplexHandler

public abstract class SimpleInboundHandler<I,E,A extends Address> extends AddressHandlerAdapter<A>
HandlerAdapter which allows to explicit only handle a specific type of messages and events.

For example here is an implementation which only handle MessageEvent events.

     public class MessageEventHandler extends
             SimpleInboundHandler<ApplicationMessage, MessageEvent,
             CompressedPublicKey> {

        @Override
         protected void matchedEventTriggered(HandlerContext ctx,
             MessageEvent event) {
             System.out.println(event);
         }

        @Override
         protected void matchedRead(HandlerContext ctx,
             CompressedPublicKey sender, ApplicationMessage msg,
             CompletableFuture<Void> future) {
             System.out.println(msg);
         }
     }
 
  • Constructor Details

    • SimpleInboundHandler

      protected SimpleInboundHandler()
      Create a new instance which will try to detect the types to match out of the type parameter of the class.
    • SimpleInboundHandler

      protected SimpleInboundHandler(Class<? extends I> inboundMessageType, Class<? extends E> inboundEventType, Class<? extends A> addressType)
      Create a new instance
      Parameters:
      inboundMessageType - the type of messages to match
      inboundEventType - the type of events to match
      addressType - the type of the address to match
  • Method Details