Beispiel #1
0
        internal MessageSender(IQueueWriter writer, QueueMessageSerializer serializer)
        {
            if (writer == null) throw new ArgumentNullException("writer");
            if (serializer == null) throw new ArgumentNullException("serializer");

            _writer = writer;
            _serializer = serializer;
        }
        public NamespaceBasedCommandRouter(string queueNamePrefix, IQueueFactory queueFactory, ISerializer serializer)
        {
            if (queueFactory == null) throw new ArgumentNullException("queueFactory");
            if (serializer == null) throw new ArgumentNullException("serializer");

            //prefix for namespace-based queue names
            _queueNamePrefix = MakePrefix(queueNamePrefix);

            _queueFactory = queueFactory;

            //this guy again :(
            _serializer = new QueueMessageSerializer(serializer);
        }
        /// <summary>
        /// Creates an instance of a dispatcher.
        /// </summary>
        /// <param name="dispatchTo">Where to dispatch incoming messages</param>
        /// <param name="serializer">How to deserialize incoming messages</param>
        /// <param name="receiver">How to receive messages</param>
        public ReceivedMessageDispatcher(
            Action<object> dispatchTo,
            ISerializer serializer,
            IIncomingMessagesStream receiver)
        {
            if (dispatchTo == null) throw new ArgumentNullException("dispatchTo");
            if (serializer == null) throw new ArgumentNullException("serializer");
            if (receiver == null) throw new ArgumentNullException("receiver");

            _dispatchTo = dispatchTo;
            _receiver = receiver;

            //did I tell you I hate this guy? Oh, I do...
            _serializer = new QueueMessageSerializer(serializer);
        }