protected virtual T DeserializePayload <T>(byte[] data) { try { return(BinaryMessageSerializer.DeserializePayload <T>(data)); } catch (Exception ex) { throw new ActorSerializationException($"{CurrentActor} failed to deserialize data of type, error message {ex.Message}", ex, typeof(T)); } }
public async Task <object> RetrieveMessageAsync(string key, Type typeOfPayload, CancellationToken cancellationToken) { var proxy = ActorProxy.Create <IStorageActor>(new ActorId($"{NameCompositionResolver.ExtractFlowInstanceIdFromFlowVariableKey(key)}"), StorageServiceUri); var rawData = await proxy.RetrieveMessageAsync(new ActorRequestContext(Guid.NewGuid().ToString(), null, Guid.NewGuid().ToString()), key, false, cancellationToken); var data = rawData == null ? null : BinaryMessageSerializer.DeserializePayload(rawData, typeOfPayload); return(data); }