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 InitializeEndpoint()
        {
            lock(_initializationMonitor) {
                if(_initialized) {
                    return;
                }

                AssertUtils.ArgumentHasText(_inputChannelName, "inputChannelName is required");

                AssertUtils.IsTrue(_objectFactory.ContainsObject(_inputChannelName), "no such input channel '" + _inputChannelName + "' for endpoint '" + _objectName + "'");

                IMessageChannel channel = (IMessageChannel)_objectFactory.GetObject(_inputChannelName, typeof(IMessageChannel));
                if(channel is ISubscribableChannel) {
                    if (_pollerMetadata != null)
                        throw new ArgumentException("A poller should not be specified for endpoint '" + _objectName
                                                                + "', since '" + _inputChannelName + "' is a SubscribableChannel (not pollable).");
                    _endpoint = new EventDrivenConsumer((ISubscribableChannel)channel, _handler);
                }
                else if(channel is IPollableChannel) {
                    PollingConsumer pollingConsumer = new PollingConsumer((IPollableChannel)channel, _handler);
                    if(_pollerMetadata == null) {
                        _pollerMetadata = IntegrationContextUtils.GetDefaultPollerMetadata(_objectFactory);
                        AssertUtils.ArgumentNotNull(_pollerMetadata, "No poller has been defined for endpoint '" + _objectName + "', and no default poller is available within the context.");
                    }
                    pollingConsumer.Trigger = _pollerMetadata.Trigger;
                    pollingConsumer.MaxMessagesPerPoll = _pollerMetadata.MaxMessagesPerPoll;
                    pollingConsumer.ReceiveTimeout = _pollerMetadata.ReceiveTimeout;
                    pollingConsumer.TaskExecutor = _pollerMetadata.TaskExecutor;
                    pollingConsumer.TransactionManager = _pollerMetadata.TransactionManager;
                    pollingConsumer.TransactionDefinition = _pollerMetadata.TransactionDefinition;
                    pollingConsumer.AdviceChain = _pollerMetadata.AdviceChain;
                    _endpoint = pollingConsumer;
                }
                else {
                    throw new ArgumentException("unsupported channel type: [" + channel.GetType() + "]");
                }
                _endpoint.AutoStartup = _autoStartup;
                _endpoint.ObjectName = _objectName;
                _endpoint.ObjectFactory = _objectFactory;
                _endpoint.AfterPropertiesSet();
                _initialized = true;
            }
        }