/* ============================================================================== 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(); } }
internal ClusterMessage(ClusterMemberInfo sender) { this.SenderInfo = sender; }
public MsmqChannelProvider(IClusterMessageFormatter formatter, ClusterMemberInfo memberInfo) : base(formatter, memberInfo) { }
public VoidChannel(IClusterMessageFormatter formatter, ClusterMemberInfo clusterMemberInfo) : base(formatter, clusterMemberInfo) { }
public LoopbackChannel(IClusterMessageFormatter formatter, ClusterMemberInfo clusterMemberInfo) : base(formatter, clusterMemberInfo) { }
public TraceChannel(IClusterMessageFormatter formatter, ClusterMemberInfo clusterMemberInfo) : base(formatter, clusterMemberInfo) { }
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); }
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"); }