コード例 #1
0
 public MessageStorePublisher(MessageStore store, MessageSender sender, NuclearStorage storage, Predicate<StoreRecord> recordShouldBePublished)
 {
     _store = store;
     _sender = sender;
     _storage = storage;
     _recordShouldBePublished = recordShouldBePublished;
 }
コード例 #2
0
ファイル: EventStoreTest.cs プロジェクト: RossMerr/lokad-cqrs
        public void SetUp()
        {
            _serializer = new TestMessageSerializer(new[] { typeof(TestEvent) });
            _path = Path.Combine(Path.GetTempPath(), "MessageStore", Guid.NewGuid().ToString());
            if (!Directory.Exists(_path))
                Directory.CreateDirectory(_path);
            _appendOnlyStore = new FileAppendOnlyStore(new DirectoryInfo(_path));
            _appendOnlyStore.Initialize();

            _messageStore = new MessageStore(_appendOnlyStore, _serializer);
        }
コード例 #3
0
        public void when_append_to_store()
        {
            var store = new MessageStore(_appendOnlyStore, _serializer);
            store.AppendToStore("stream5", MessageAttribute.Empty, -1, new[] { "msg1", "msg2", "msg3" });
            var records = store.EnumerateMessages("stream5", 0, Int32.MaxValue).ToArray();

            Assert.AreEqual(1, records.Length);
            Assert.AreEqual(3, records[0].Items.Length);
            //todo simple types are not properly deserialize
            //Assert.AreEqual("msg1", records[0].Items[0].ToString());
            //Assert.AreEqual("msg2", records[0].Items[1].ToString());
            //Assert.AreEqual("msg3", records[0].Items[2].ToString());
        }
コード例 #4
0
        public void SetUp()
        {
            _storeRecords = new List<StoreRecord>();
            _serializer = new TestMessageSerializer(new[] { typeof(SerializerTest1), typeof(SerializerTest2), typeof(string) });
            _path = Path.Combine(Path.GetTempPath(), "MessageStorePublisher", Guid.NewGuid().ToString());
            _appendOnlyStore = new FileAppendOnlyStore(new DirectoryInfo(_path));
            _appendOnlyStore.Initialize();
            _store = new MessageStore(_appendOnlyStore, _serializer);
            var streamer = new EnvelopeStreamer(_serializer);
            var queueWriter = new TestQueueWriter();
            _sender = new MessageSender(streamer, queueWriter);
            var store = new FileDocumentStore(Path.Combine(_path, "lokad-cqrs-test"), new DocumentStrategy());
            _nuclearStorage = new NuclearStorage(store);

            _publisher = new MessageStorePublisher(_store, _sender, _nuclearStorage, DoWePublishThisRecord);
        }
コード例 #5
0
        public void SetUp()
        {
            _serializer = new TestMessageSerializer(new[] { typeof(SerializerTest1), typeof(SerializerTest2), typeof(string) });
            _path = Path.Combine(Path.GetTempPath(), "MessageStore", Guid.NewGuid().ToString());
            if (!Directory.Exists(_path))
                Directory.CreateDirectory(_path);
            _appendOnlyStore = new FileAppendOnlyStore(new DirectoryInfo(_path));

            var store = new MessageStore(_appendOnlyStore, _serializer);
            store.AppendToStore("stream1", MessageAttribute.Empty, -1, new[] { new SerializerTest1("msg1") });
            store.AppendToStore("stream2", MessageAttribute.Empty, -1, new[] { new SerializerTest1("msg1"), new SerializerTest1("msg2") });
            store.AppendToStore("stream3", MessageAttribute.Empty, -1, new[] { new SerializerTest1("msg1"), new SerializerTest1("msg2"), new SerializerTest1("msg3") });
            store.RecordMessage("stream4", new ImmutableEnvelope("EnvId", DateTime.UtcNow, new SerializerTest1("msg1"), MessageAttribute.Empty));

            _appendOnlyStore.Close();
            _appendOnlyStore = new FileAppendOnlyStore(new DirectoryInfo(_path));
            _appendOnlyStore.Initialize();

            _store = new MessageStore(_appendOnlyStore, _serializer);
        }
コード例 #6
0
ファイル: EventStore.cs プロジェクト: JoergEg/lokad-cqrs
 public EventStore(MessageStore store)
 {
     _store = store;
 }
コード例 #7
0
        public void when_append_to_store()
        {
            var store = new MessageStore(_appendOnlyStore, _serializer);
            store.AppendToStore("stream5", MessageAttribute.Empty, -1, new[] { new SerializerTest1 { Name = "name1" } });
            var records = store.EnumerateMessages("stream5", 0, Int32.MaxValue).ToArray();

            Assert.AreEqual(1, records.Length);
            Assert.AreEqual(1, records[0].Items.Length);
            Assert.AreEqual("name1", (records[0].Items[0] as SerializerTest1).Name);
        }