Search in sources :

Example 1 with ScaleCubeMessage

use of org.apache.ignite.internal.network.message.ScaleCubeMessage in project ignite-3 by apache.

the class ScaleCubeDirectMarshallerTransport method fromNetworkMessage.

/**
 * Unwrap ScaleCube {@link Message} from {@link NetworkMessage}.
 *
 * @param networkMessage Network message.
 * @return ScaleCube message.
 * @throws IgniteInternalException If failed to read ScaleCube message byte array.
 */
@Nullable
private Message fromNetworkMessage(NetworkMessage networkMessage) throws IgniteInternalException {
    if (networkMessage instanceof ScaleCubeMessage) {
        ScaleCubeMessage msg = (ScaleCubeMessage) networkMessage;
        Map<String, String> headers = msg.headers();
        Object obj = msg.data();
        NetworkMessage message = msg.message();
        Object data = obj != null ? obj : message;
        return Message.withHeaders(headers).data(data).build();
    }
    return null;
}
Also used : ScaleCubeMessage(org.apache.ignite.internal.network.message.ScaleCubeMessage) NetworkMessage(org.apache.ignite.network.NetworkMessage) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ScaleCubeMessage (org.apache.ignite.internal.network.message.ScaleCubeMessage)1 NetworkMessage (org.apache.ignite.network.NetworkMessage)1 Nullable (org.jetbrains.annotations.Nullable)1