Package org.jgroups

Interface MessageFactory

    • Method Detail

      • create

        <T extends Message> T create​(short id)
        Creates a message based on the given ID
        Type Parameters:
        T - The type of the message
        Parameters:
        id - The ID
        Returns:
        A message
      • register

        <M extends MessageFactory> M register​(short type,
                                              java.util.function.Supplier<? extends Message> generator)
        Registers a new creator of messages
        Parameters:
        type - The type associated with the new payload. Needs to be the same in all nodes of the same cluster, and needs to be available (ie., not taken by JGroups or other applications).
        generator - The creator of the payload associated with the given type