You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Aleksandr Polovtcev (Jira)" <ji...@apache.org> on 2021/05/24 20:50:00 UTC

[jira] [Assigned] (IGNITE-14715) Create an annotation processor for generating network message implementations

     [ https://issues.apache.org/jira/browse/IGNITE-14715?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aleksandr Polovtcev reassigned IGNITE-14715:
--------------------------------------------

    Assignee: Aleksandr Polovtcev

> 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
>
> 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)