public async Task Post(ActorWrap actorWrap) { var actorIdObj = new ActorId(actorWrap.ActorGuid); IConActor actor = null; try { actor = ActorProxy.Create <IConActor>( actorIdObj, new Uri("fabric:/DataLossCheckApp/ConActorService")); await actor.SetCountAsync(actorWrap.Value, CancellationToken.None); // log message await Helper.LogMessage(actorWrap.ActorGuid, $"SET - {actorWrap.Value}"); } catch (Exception ex) { // log message await Helper.LogMessage(actorWrap.ActorGuid, $"SET ERROR - {ex.ToString()}"); } finally { if (actorIdObj != null) { actorIdObj = null; } if (actor != null) { actor = null; } } }
public async Task <int> Get(string actorId) { var actorIdObj = new ActorId(actorId); IConActor actor = null; try { actor = ActorProxy.Create <IConActor>( actorIdObj, new Uri("fabric:/DataLossCheckApp/ConActorService")); var result = await actor.GetCountAsync(CancellationToken.None); // log message await Helper.LogMessage(actorId, $"GET - {result}"); return(result); } catch (Exception ex) { // log message await Helper.LogMessage(actorId, $"GET ERROR - {ex.ToString()}"); throw ex; } finally { if (actorIdObj != null) { actorIdObj = null; } if (actor != null) { actor = null; } } }