private MessageHandlerNode handlerNode(String name, IntegrationConsumer consumer) { MessageChannel outputChannel = consumer.getOutputChannel(); String outputChannelName = outputChannel == null ? null : outputChannel.toString(); MessageHandler handler = consumer.getHandler(); if (handler instanceof CompositeMessageHandler) { return compositeHandler(name, consumer, (CompositeMessageHandler) handler, outputChannelName, null, false); } else if (handler instanceof DiscardingMessageHandler) { return discardingHandler(name, consumer, (DiscardingMessageHandler) handler, outputChannelName, null, false); } else if (handler instanceof MappingMessageRouterManagement) { return routingHandler(name, consumer, handler, (MappingMessageRouterManagement) handler, outputChannelName, null, false); } else if (handler instanceof RecipientListRouterManagement) { return recipientListRoutingHandler(name, consumer, handler, (RecipientListRouterManagement) handler, outputChannelName, null, false); } else { String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return new MessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, outputChannelName); } }
private MessageHandlerNode routingHandler(String name, IntegrationConsumer consumer, MessageHandler handler, MappingMessageRouterManagement router, String output, String errors, boolean polled) { Collection<String> routes = Stream.concat(router.getChannelMappings().values().stream(), router.getDynamicChannelNames().stream()) .collect(Collectors.toList()); String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableRoutingNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, errors, routes) : new RoutingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, routes); }
endpoint = this.applicationContext.getBean(beanName, IntegrationConsumer.class); try { MessageHandler handler = endpoint.getHandler(); if (handler.equals(monitor) || extractTarget(handlerInAnonymousWrapper(handler)).equals(monitor)) { MessageChannel inputChannel = endpoint.getInputChannel(); if (inputChannel != null) { if (!this.anonymousHandlerCounters.containsKey(inputChannel)) {
private void postProcessAbstractEndpoint(Object bean) { if (bean instanceof IntegrationConsumer) { IntegrationConsumer integrationConsumer = (IntegrationConsumer) bean; MessageHandler handler = integrationConsumer.getHandler(); if (handler instanceof MessageHandlerMetrics) { MessageHandlerMetrics messageHandlerMetrics = (MessageHandlerMetrics) extractTarget(handler); registerHandler(messageHandlerMetrics); this.handlers.add(messageHandlerMetrics); this.runtimeBeans.add(messageHandlerMetrics); return; } } else if (bean instanceof SourcePollingChannelAdapter) { SourcePollingChannelAdapter pollingChannelAdapter = (SourcePollingChannelAdapter) bean; MessageSource<?> messageSource = pollingChannelAdapter.getMessageSource(); if (messageSource instanceof MessageSourceMetrics) { MessageSourceMetrics messageSourceMetrics = (MessageSourceMetrics) extractTarget(messageSource); registerSource(messageSourceMetrics); this.sources.add(messageSourceMetrics); this.runtimeBeans.add(messageSourceMetrics); return; } } registerEndpoint((AbstractEndpoint) bean); this.runtimeBeans.add(bean); }
private MessageHandlerNode recipientListRoutingHandler(String name, IntegrationConsumer consumer, MessageHandler handler, RecipientListRouterManagement router, String output, String errors, boolean polled) { List<String> routes = router.getRecipients() .stream() .map(recipient -> ((Recipient) recipient).getChannel().toString()) .collect(Collectors.toList()); String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableRoutingNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, errors, routes) : new RoutingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, routes); }
private MessageHandlerNode handlerNode(String name, IntegrationConsumer consumer) { MessageChannel outputChannel = consumer.getOutputChannel(); String outputChannelName = outputChannel == null ? null : outputChannel.toString(); MessageHandler handler = consumer.getHandler(); if (handler instanceof CompositeMessageHandler) { return compositeHandler(name, consumer, (CompositeMessageHandler) handler, outputChannelName, null, false); } else if (handler instanceof DiscardingMessageHandler) { return discardingHandler(name, consumer, (DiscardingMessageHandler) handler, outputChannelName, null, false); } else if (handler instanceof MappingMessageRouterManagement) { return routingHandler(name, consumer, handler, (MappingMessageRouterManagement) handler, outputChannelName, null, false); } else if (handler instanceof RecipientListRouterManagement) { return recipientListRoutingHandler(name, consumer, handler, (RecipientListRouterManagement) handler, outputChannelName, null, false); } else { String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return new MessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, outputChannelName); } }
private MessageHandlerNode discardingHandler(String name, IntegrationConsumer consumer, DiscardingMessageHandler handler, String output, String errors, boolean polled) { String discards = handler.getDiscardChannel() != null ? handler.getDiscardChannel().toString() : null; String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableDiscardingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, discards, errors) : new DiscardingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, discards); }
private MessageHandlerNode compositeHandler(String name, IntegrationConsumer consumer, CompositeMessageHandler handler, String output, String errors, boolean polled) { List<CompositeMessageHandlerNode.InnerHandler> innerHandlers = handler.getHandlers() .stream() .filter(NamedComponent.class::isInstance) .map(NamedComponent.class::cast) .map(named -> new CompositeMessageHandlerNode.InnerHandler( named.getComponentName(), named.getComponentType())) .collect(Collectors.toList()); String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableCompositeMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, errors, innerHandlers) : new CompositeMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, innerHandlers); }
private MessageHandlerNode routingHandler(String name, IntegrationConsumer consumer, MessageHandler handler, MappingMessageRouterManagement router, String output, String errors, boolean polled) { Collection<String> routes = Stream.concat(router.getChannelMappings().values().stream(), router.getDynamicChannelNames().stream()) .collect(Collectors.toList()); String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableRoutingNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, errors, routes) : new RoutingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, routes); }
private MessageHandlerNode discardingHandler(String name, IntegrationConsumer consumer, DiscardingMessageHandler handler, String output, String errors, boolean polled) { String discards = handler.getDiscardChannel() != null ? handler.getDiscardChannel().toString() : null; String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableDiscardingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, discards, errors) : new DiscardingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, discards); }
private MessageHandlerNode recipientListRoutingHandler(String name, IntegrationConsumer consumer, MessageHandler handler, RecipientListRouterManagement router, String output, String errors, boolean polled) { List<String> routes = router.getRecipients() .stream() .map(recipient -> ((Recipient) recipient).getChannel().toString()) .collect(Collectors.toList()); String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableRoutingNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, errors, routes) : new RoutingMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, routes); }
private MessageHandlerNode compositeHandler(String name, IntegrationConsumer consumer, CompositeMessageHandler handler, String output, String errors, boolean polled) { List<CompositeMessageHandlerNode.InnerHandler> innerHandlers = handler.getHandlers() .stream() .filter(NamedComponent.class::isInstance) .map(NamedComponent.class::cast) .map(named -> new CompositeMessageHandlerNode.InnerHandler( named.getComponentName(), named.getComponentType())) .collect(Collectors.toList()); String inputChannel = consumer.getInputChannel() != null ? consumer.getInputChannel().toString() : null; return polled ? new ErrorCapableCompositeMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, errors, innerHandlers) : new CompositeMessageHandlerNode(this.nodeId.incrementAndGet(), name, handler, inputChannel, output, innerHandlers); }