private void RegisterReplyMessageCorrelator() { lock (_replyMessageCorrelatorMonitor) { if (_replyMessageCorrelator != null) { return; } AbstractEndpoint correlator = null; IMessageHandler handler = new LocalReplyProducingMessageHandler(); if (_replyChannel is ISubscribableChannel) { correlator = new EventDrivenConsumer((ISubscribableChannel)_replyChannel, handler); } else if (_replyChannel is IPollableChannel) { PollingConsumer endpoint = new PollingConsumer( (IPollableChannel)_replyChannel, handler); endpoint.Trigger = new IntervalTrigger(TimeSpan.FromMilliseconds(10)); endpoint.ObjectFactory = ObjectFactory; endpoint.AfterPropertiesSet(); correlator = endpoint; } if (IsRunning) { if (correlator == null) { throw new InvalidOperationException("correlator must not be null"); } ((ILifecycle)correlator).Start(); } _replyMessageCorrelator = correlator; } }
private void RegisterReplyMessageCorrelator() { lock(_replyMessageCorrelatorMonitor) { if(_replyMessageCorrelator != null) { return; } AbstractEndpoint correlator = null; IMessageHandler handler = new LocalReplyProducingMessageHandler(); if(_replyChannel is ISubscribableChannel) { correlator = new EventDrivenConsumer((ISubscribableChannel)_replyChannel, handler); } else if(_replyChannel is IPollableChannel) { PollingConsumer endpoint = new PollingConsumer( (IPollableChannel)_replyChannel, handler); endpoint.Trigger = new IntervalTrigger(TimeSpan.FromMilliseconds(10)); endpoint.ObjectFactory = ObjectFactory; endpoint.AfterPropertiesSet(); correlator = endpoint; } if(IsRunning) { if(correlator == null) throw new InvalidOperationException("correlator must not be null"); ((ILifecycle)correlator).Start(); } _replyMessageCorrelator = correlator; } }