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

Denis Chudov updated IGNITE-20296:
----------------------------------
    Description: 
*Motivation*

With {{MessagingService}} we have an ability to send message using 
{{ClusterNode}} to specify a recipient. But in {{NetworkMessageHandler}} we 
have only ability to receive consistent id of a sender. However, in some cases 
we need node id (for example, knowing that there is no node we the given id in 
a cluster, allows us to not send message there at all, because this node has 
left the topology at least once since it had sent this message and therefore 
this node lost its volatile state)

Also, the node id should go along with consistent id, so 
{color:#172b4d}{{ClusterNode}} {color}as the argument type is preferred.

*Definition of done*

The following interface is available:
{code:java}
public interface NetworkMessageHandler {
    /**
     * Method that gets invoked when a network message is received.
     *
     * @param message Message, which was received from the cluster.
     * @param sender Sender node.
     * @param correlationId Correlation id. Used to track correspondence 
between requests and responses. Can be {@code null} if the received
     *     message is not a request from a {@link MessagingService#invoke} 
method from another node.
     */
    void onReceived(NetworkMessage message, ClusterNode sender, @Nullable Long 
correlationId);
} {code}
Also, the {{MessagingService}} is able to accept an object implementing this 
interface as a message handler.

*Implementation notes*

The ClusterNode passed as a sender should have a node id which the sender node 
had at the moment the message was sent.

  was:
*Motivation*

With {{MessagingService}} we have an ability to send message using 
{{ClusterNode}} to specify a recipient. But in {{NetworkMessageHandler}} we 
have only ability to receive consistent id of a sender. However, in some cases 
we need node id (for example, knowing that there is no node we the given id in 
a cluster, allows us to not send message there at all, because this node has 
left the topology at least once since it had sent this message and therefore 
this node lost its volatile state)

Also, the node id should go along with consistent id, so 
{color:#172b4d}{{ClusterNode}} {color}as the argument type is preferred.

*Definition of done*

The following interface is available:
{code:java}
public interface NetworkMessageHandler {
    /**
     * Method that gets invoked when a network message is received.
     *
     * @param message Message, which was received from the cluster.
     * @param sender Sender node.
     * @param correlationId Correlation id. Used to track correspondence 
between requests and responses. Can be {@code null} if the received
     *     message is not a request from a {@link MessagingService#invoke} 
method from another node.
     */
    void onReceived(NetworkMessage message, ClusterNode sender, @Nullable Long 
correlationId);
} {code}
Also, the {{MessagingService }}is able to accept an object implementing this 
interface as a message handler.

*Implementation notes*

The ClusterNode passed as a sender should have a node id which the sender node 
had at the moment the message was sent.


> Make a network message handler that would be able to accept ClusterNode as a 
> sender
> -----------------------------------------------------------------------------------
>
>                 Key: IGNITE-20296
>                 URL: https://issues.apache.org/jira/browse/IGNITE-20296
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Denis Chudov
>            Priority: Major
>
> *Motivation*
> With {{MessagingService}} we have an ability to send message using 
> {{ClusterNode}} to specify a recipient. But in {{NetworkMessageHandler}} we 
> have only ability to receive consistent id of a sender. However, in some 
> cases we need node id (for example, knowing that there is no node we the 
> given id in a cluster, allows us to not send message there at all, because 
> this node has left the topology at least once since it had sent this message 
> and therefore this node lost its volatile state)
> Also, the node id should go along with consistent id, so 
> {color:#172b4d}{{ClusterNode}} {color}as the argument type is preferred.
> *Definition of done*
> The following interface is available:
> {code:java}
> public interface NetworkMessageHandler {
>     /**
>      * Method that gets invoked when a network message is received.
>      *
>      * @param message Message, which was received from the cluster.
>      * @param sender Sender node.
>      * @param correlationId Correlation id. Used to track correspondence 
> between requests and responses. Can be {@code null} if the received
>      *     message is not a request from a {@link MessagingService#invoke} 
> method from another node.
>      */
>     void onReceived(NetworkMessage message, ClusterNode sender, @Nullable 
> Long correlationId);
> } {code}
> Also, the {{MessagingService}} is able to accept an object implementing this 
> interface as a message handler.
> *Implementation notes*
> The ClusterNode passed as a sender should have a node id which the sender 
> node had at the moment the message was sent.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to