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;
}
Aggregations