public void SendToSerializer(DbFileRow row, ImportEntityType type) { var message = new ImportEntityMessage(type, row); if (_eventStoreActor is not null) { _eventStoreActor.Tell(message); return; } var target = _cluster.State.Members.First(e => e.HasRole("eventstore")); var targetUrl = $"{target.Address}/user/{ActorNames.Serializer}"; Context.ActorSelection(targetUrl).Tell(message); }
public void OnImportEntity(ImportEntityMessage message) { var row = message.EntityRow; if (row is null) { return; } // Serializes according to ImportEntityType UpsertMessage toInsert = message.Type switch { Artist => UpsertArtist.FromRow(row), ArtistCollection => UpsertArtistCollection.FromRow(row), Collection => UpsertCollection.FromRow(row), CollectionMatch => UpsertCollectionMatch.FromRow(row), _ => throw new System.NotImplementedException(), }; _log.Info($"New {message.Type} to update"); SaveUpsert(toInsert); UpdateProjection(toInsert); }