private void HandleMessage(CreateEventMarket message) { try { var cluster = Cluster.Get(Context.System); var replicator = DistributedData.Get(Context.System).Replicator; var key = new ORSetKey <string>($"Event-{message.EventId}"); var writeConsistency = new WriteMajority(TimeSpan.FromSeconds(2)); replicator.Tell(Dsl.Update(key, ORSet <string> .Empty, writeConsistency, existing => existing.Add(cluster, message.Market))); var localEvent = replicator.Ask <IGetResponse>(Dsl.Get(key, ReadLocal.Instance)); Sender.Tell(localEvent.Result); } catch (Exception e) { _log.Error(e, "Unable to process message CreateEventMarket for Event {0} Market {1}", message.EventId, message.Market); Sender.Tell( $"Unable to process message CreateEventMarket for Event {message.EventId} Market {message.Market}"); } }
private void HandleMessage(CreateEventMarket selection) { var key = new ORSetKey <string>($"Event-{selection.EventId}"); var readConsistency = ReadLocal.Instance; var reply = Task.Run(() => { var result = _ddataStore.Ask <IGetResponse>(Get(key, readConsistency), TimeSpan.FromSeconds(2)); if (result.Result.IsSuccessful) { Sender.Tell(result.Result.Get(key)); } }); }