Beispiel #1
0
        /* ============================================================================== Init */
        public ClusterChannel(IClusterMessageFormatter formatter, ClusterMemberInfo clusterMemberInfo)
        {
            _incomingMessages = new List<ClusterMessage>();
            CounterManager.Reset("IncomingMessages");
            CounterManager.Reset("TotalMessagesToProcess");

            //_incomingMessageSignal = new AutoResetEvent(false);
            m_formatter = formatter;
            m_clusterMemberInfo = clusterMemberInfo;

            // initiate processing threads
            for (var i = 0; i < RepositoryConfiguration.MessageProcessorThreadCount; i++)
            {
                var thstart = new ParameterizedThreadStart(CheckProcessableMessages);
                var thread = new Thread(thstart);
                //thread.Priority = ThreadPriority.Highest;
                thread.Name = i.ToString();
                thread.Start();
            }
        }
Beispiel #2
0
 internal ClusterMessage(ClusterMemberInfo sender)
 {
     this.SenderInfo = sender;
 }
Beispiel #3
0
 public MsmqChannelProvider(IClusterMessageFormatter formatter,
     ClusterMemberInfo memberInfo)
     : base(formatter, memberInfo)
 { }
Beispiel #4
0
 public VoidChannel(IClusterMessageFormatter formatter,
                    ClusterMemberInfo clusterMemberInfo) : base(formatter, clusterMemberInfo)
 {
 }
Beispiel #5
0
 public LoopbackChannel(IClusterMessageFormatter formatter,
                        ClusterMemberInfo clusterMemberInfo) : base(formatter, clusterMemberInfo)
 {
 }
Beispiel #6
0
 public LoopbackChannel(IClusterMessageFormatter formatter, 
     ClusterMemberInfo clusterMemberInfo) : base(formatter, clusterMemberInfo)
 {
 }
Beispiel #7
0
 public TraceChannel(IClusterMessageFormatter formatter, ClusterMemberInfo clusterMemberInfo)
     : base(formatter, clusterMemberInfo)
 {
 }
Beispiel #8
0
 internal ClusterMessage(ClusterMemberInfo sender)
 {
     this.SenderInfo = sender;
 }
Beispiel #9
0
 private Stream HackMessageAsRemote(DistributedLuceneActivity.LuceneActivityDistributor message)
 {
     var formatter = new BinaryMessageFormatter();
     var clusterMemberInfo = new ClusterMemberInfo();
     clusterMemberInfo.InstanceID = Guid.NewGuid().ToString();   // ensures message percieved as coming from other source
     message.SenderInfo = clusterMemberInfo;
     return formatter.Serialize(message);
 }
Beispiel #10
0
        public void Msmq_Receive()
        {
            var msmq = DistributedApplication.ClusterChannel as MsmqChannelProvider;

            // init: purge queues
            msmq._receiveQueue.Purge();
            for (var i = 0; i < msmq._sendQueues.Count; i++)
            {
                var sendqueue = msmq._sendQueues[i];
                sendqueue.Purge();
            }

            // send a single message to the receive queue and check if it gets received and executed
            var message = new TestAction();

            var clusterMemberInfo = new ClusterMemberInfo();
            clusterMemberInfo.InstanceID = Guid.NewGuid().ToString();   // ensures message percieved as coming from other source

            message.SenderInfo = clusterMemberInfo;
            Stream messageStream = new BinaryMessageFormatter().Serialize(message);
            var m = new System.Messaging.Message(messageStream);
            m.TimeToBeReceived = TimeSpan.FromSeconds(RepositoryConfiguration.MessageRetentionTime);
            m.Formatter = new System.Messaging.BinaryMessageFormatter();

            _messageReceivedEvent = new AutoResetEvent(false);
            msmq._receiveQueue.Send(m); // send message to receivequeue

            // test for execution: _messageReceived should be set to true
            var received = _messageReceivedEvent.WaitOne(3000);
            Assert.IsTrue(received, "Distributed action was not received/executed within 3 seconds");
        }