public MessageStorePublisher(MessageStore store, MessageSender sender, NuclearStorage storage, Predicate<StoreRecord> recordShouldBePublished) { _store = store; _sender = sender; _storage = storage; _recordShouldBePublished = recordShouldBePublished; }
public void when_send_message() { var serializer = new TestMessageSerializer(new[] { typeof(SerializerTest1), typeof(SerializerTest2), }); var streamer = new EnvelopeStreamer(serializer); var queueWriter = new FileQueueWriter(new DirectoryInfo(_path), "test"); var sender = new MessageSender(streamer, queueWriter); sender.Send(new SerializerTest1("Name1"), "EnvId", new[] { new MessageAttribute("key1", "val1"), new MessageAttribute("key2", "val2"), }); sender.Send(new SerializerTest1("Name1"), "EnvId"); Assert.AreEqual(2, Directory.GetFiles(_path).Length); }
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); }
public TypedMessageSender(MessageSender commandRouter, MessageSender functionalRecorder) { _commandRouter = commandRouter; _functionalRecorder = functionalRecorder; }