[ https://issues.apache.org/jira/browse/IGNITE-14715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ivan Bessonov updated IGNITE-14715: ----------------------------------- Ignite Flags: (was: Docs Required,Release Notes Required) > Create an annotation processor for generating network message implementations > ----------------------------------------------------------------------------- > > Key: IGNITE-14715 > URL: https://issues.apache.org/jira/browse/IGNITE-14715 > Project: Ignite > Issue Type: Sub-task > Components: networking > Reporter: Aleksandr Polovtcev > Assignee: Aleksandr Polovtcev > Priority: Minor > Fix For: 3.0.0-alpha3 > > Time Spent: 5h 20m > Remaining Estimate: 0h > > Currently all {{NetworkMessage}} implementations are created by hand which is > inconvenient (e.g. one needs to declare constructors and getters). It is > proposed to automatically generate these implementations using an annotation > processor. > h3. Implementation details > * Custom messages should be declared as interfaces extending > {{NetworkMessage}}. Methods in these interfaces should correspond to the > message fields, for example: > {code:java} > @Message(type = ACTION_REQUEST) > public interface ActionRequest extends NetworkMessage { > String groupId(); > Command command(); > } > {code} > * Every message interface should be annotated with the {{@Message}} > interface, with a *message type* parameter of type {{short}}, unique across a > *module*. All message types should be manually listed in an interface marked > with the {{@MessageTypes}} annotation with a *module identifier*. For example: > {code:java} > @MessageTypes(moduleType = 10) > class RaftMessageTypes { > public final short ACTION_REQUEST = 1; > } > {code} > * Message implementations should have a generated {{Builder}} interface for > creating new messages: > {code:java} > public interface Builder { > Builder command(Command cmd); > Builder groupId(String groupId); > ActionRequest build(); > } > {code} > * {{Builder}} instances should be obtained using a generated factory, based > on the current module type: > {code:java} > public interface RaftClientMessageFactory { > ActionRequestBuilder actionRequest(); > ActionResponseBuilder actionResponse(); > // ... > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)