public void AfterSingletonsInstantiated() { if (_streamListenerMethods.Count <= 0) { return; } foreach (var method in _streamListenerMethods) { DoPostProcess(method); } foreach (var mappedBindingEntry in _mappedListenerMethods) { var handlers = new List <DispatchingStreamListenerMessageHandler.ConditionalStreamListenerMessageHandlerWrapper>(); foreach (var mapping in mappedBindingEntry.Value) { var targetBean = CreateTargetBean(mapping.Implementation); var invocableHandlerMethod = _messageHandlerMethodFactory.CreateInvocableHandlerMethod(targetBean, mapping.Method); var streamListenerMessageHandler = new StreamListenerMessageHandler(_context, invocableHandlerMethod, mapping.CopyHeaders, IntegrationOptions.MessageHandlerNotPropagatedHeaders); if (!string.IsNullOrEmpty(mapping.DefaultOutputChannel)) { streamListenerMessageHandler.OutputChannelName = mapping.DefaultOutputChannel; } if (!string.IsNullOrEmpty(mapping.Condition)) { var parser = _context.GetService <IExpressionParser>(); if (parser == null) { throw new InvalidOperationException("StreamListener attribute contains a 'Condition', but no Expression parser is configured"); } var conditionAsString = ResolveExpressionAsString(mapping.Condition); var condition = parser.ParseExpression(conditionAsString); handlers.Add(new DispatchingStreamListenerMessageHandler.ConditionalStreamListenerMessageHandlerWrapper(condition, streamListenerMessageHandler)); } else { handlers.Add(new DispatchingStreamListenerMessageHandler.ConditionalStreamListenerMessageHandlerWrapper(null, streamListenerMessageHandler)); } } if (handlers.Count > 1) { foreach (var h in handlers) { if (!h.IsVoid) { throw new ArgumentException(StreamListenerErrorMessages.MULTIPLE_VALUE_RETURNING_METHODS); } } } AbstractReplyProducingMessageHandler handler; if (handlers.Count > 1 || handlers[0].Condition != null) { var evaluationContext = _context.GetService <IEvaluationContext>(); handler = new DispatchingStreamListenerMessageHandler(_context, handlers, evaluationContext); } else { handler = handlers[0].StreamListenerMessageHandler; } handler.IntegrationServices.ChannelResolver = _binderAwareChannelResolver; // handler.afterPropertiesSet(); // this.applicationContext.getBeanFactory().registerSingleton( // handler.getClass().getSimpleName() + handler.hashCode(), handler); // this.applicationContext // .getBean(mappedBindingEntry.getKey(), typeof(ISubscribableChannel)) var channel = BindingHelpers.GetBindable <IMessageChannel>(_context, mappedBindingEntry.Key) as ISubscribableChannel; if (channel == null) { throw new InvalidOperationException("Unable to locate ISubscribableChannel with ServiceName: " + mappedBindingEntry.Key); } channel.Subscribe(handler); } _mappedListenerMethods.Clear(); }