Mongo
へのサブスクリプションサービスをGet Event Store
経由で作成することが可能かどうかは疑問でしたか?おそらく私はこれを間違って表現していますが、私に説明させてください。私は現在にイベントを書き込むプロセスを持っています。NEventStore
を使用しています。私がしたいのは、Stream
にサブスクライブするサブスクリプションサービスをMongo
に持っていることです。MongoDBへのイベントストアサブスクリプションサービス
特にこのことについては、インターウェブ上で何も見つかりませんでしたが、これは可能ですか?私の質問はおそらくあなたは2つを一緒に混ぜ合わせることができますかこれを行うにはMongo
ではなくeventstore
に私のイベントを書き込む必要がありますか?おそらく、私はこの間違いを起こしています。代替案がありますか?
私のイベントが書き込まれているのが見えますが、それはトリガーに失敗します。EventAppeared
です。これはすべて私のマシン上で現在ローカルで行われています。
私はこれを行うストリップダウンアプリ作成しようとしている:私はNEventStore
を経由して私のmongoデータベースにイベントを書き込むusing (var connection = EventStoreConnection.Create(new IPEndPoint(IPAddress.Loopback, 1113)))
{
connection.SubscribeToStreamAsync(@"mongodb://localhost:27017/Test", false, EventAppeared, SubscriptionDropped);
var repository = new NEventStoreRepository();
repository.Write(new SomethingHasHappened("Hello"));
Console.ReadLine();
}
private static void SubscriptionDropped(EventStoreSubscription arg1, SubscriptionDropReason arg2, Exception arg3)
{
}
private static void EventAppeared(EventStoreSubscription arg1, ResolvedEvent arg2)
{
}
次
を使用してサブスクリプションを作成しますを
public void Write(object @event) { var id = Guid.NewGuid(); using (var scope = new TransactionScope()) { using (var store = WireupEventStore()) { using (var stream = store.OpenStream(id.ToString(), 0, int.MaxValue)) { stream.Add(new EventMessage { Body = @event }); stream.CommitChanges(Guid.NewGuid()); scope.Complete(); } } } Console.ReadKey(); } private static IStoreEvents WireupEventStore() { return Wireup .Init() .LogToOutputWindow() .UsingMongoPersistence("NEventStore.MongoDB", new DocumentObjectSerializer()) .InitializeStorageEngine() .UsingJsonSerialization() .Build(); }
GetEventStoreについてお聞きしますか? – tomliversidge
謝罪、そうです。 –
GetEventStoreのイベントストリームの名前としてmongodb接続があります。これは意図的ですか?あなたのストリームは実際に "mongodb:// localhost:27017/Test"と呼ばれていますか? – tomliversidge