/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param suffix the suffix to set. * @return the router spec. * @see AbstractMappingMessageRouter#setSuffix(String) */ public RouterSpec<K, R> suffix(String suffix) { Assert.state(this.componentsToRegister.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.suffix = suffix; this.handler.setSuffix(suffix); return _this(); }
/** * @param resolutionRequired the resolutionRequired. * @return the router spec. * @see AbstractMappingMessageRouter#setResolutionRequired(boolean) */ public RouterSpec<K, R> resolutionRequired(boolean resolutionRequired) { this.handler.setResolutionRequired(resolutionRequired); return _this(); }
/** * Set a limit for how many dynamic channels are retained (for reporting purposes). * When the limit is exceeded, the oldest channel is discarded. * <p><b>NOTE: this does not affect routing, just the reporting which dynamically * resolved channels have been routed to.</b> Default {@code 100}. * @param dynamicChannelLimit the limit. * @return the router spec. * @see AbstractMappingMessageRouter#setDynamicChannelLimit(int) */ public RouterSpec<K, R> dynamicChannelLimit(int dynamicChannelLimit) { this.handler.setDynamicChannelLimit(dynamicChannelLimit); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param prefix the prefix. * @return the router spec. * @see AbstractMappingMessageRouter#setPrefix(String) */ public RouterSpec<K, R> prefix(String prefix) { Assert.state(this.componentsToRegister.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.prefix = prefix; this.handler.setPrefix(prefix); return _this(); }
/** * Add a subflow as an alternative to a {@link #channelMapping(Object, String)}. * {@link #prefix(String)} and {@link #suffix(String)} cannot be used when subflow * mappings are used. * <p> If subflow should refer to the external {@link IntegrationFlow} bean and * there is a requirement to expect reply from there, such a reference should be * wrapped with a {@code .gateway()}: * <pre class="code"> * {@code * .subFlowMapping(false, sf -> sf.gateway(evenFlow()))) * } * </pre> * @param key the key. * @param subFlow the subFlow. * @return the router spec. */ public RouterSpec<K, R> subFlowMapping(K key, IntegrationFlow subFlow) { Assert.notNull(key, "'key' must not be null"); Assert.state(!(StringUtils.hasText(this.prefix) || StringUtils.hasText(this.suffix)), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); MessageChannel channel = obtainInputChannelFromFlow(subFlow, false); Assert.isInstanceOf(NamedComponent.class, channel, () -> "The routing channel '" + channel + "' from the flow '" + subFlow + "' must be instance of 'NamedComponent'."); this.mappingProvider.addMapping(key, (NamedComponent) channel); return _this(); }
/** * @param key the key. * @param channelName the channelName. * @return the router spec. * @see AbstractMappingMessageRouter#setChannelMapping(String, String) */ public RouterSpec<K, R> channelMapping(K key, final String channelName) { Assert.notNull(key, "'key' must not be null"); Assert.hasText(channelName, "'channelName' must not be null"); if (key instanceof String) { this.handler.setChannelMapping((String) key, channelName); } else { this.mappingProvider.addMapping(key, new NamedComponent() { @Override public String getComponentName() { return channelName; } @Override public String getComponentType() { return "channel"; } }); } return _this(); }
/** * @param resolutionRequired the resolutionRequired. * @return the router spec. * @see AbstractMappingMessageRouter#setResolutionRequired(boolean) */ public RouterSpec<K, R> resolutionRequired(boolean resolutionRequired) { this.handler.setResolutionRequired(resolutionRequired); return _this(); }
/** * @param resolutionRequired the resolutionRequired. * @return the router spec. * @see AbstractMappingMessageRouter#setResolutionRequired(boolean) */ public RouterSpec<K, R> resolutionRequired(boolean resolutionRequired) { this.target.setResolutionRequired(resolutionRequired); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param prefix the prefix. * @return the router spec. * @see AbstractMappingMessageRouter#setPrefix(String) */ public RouterSpec<K, R> prefix(String prefix) { Assert.state(this.componentsToRegister.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.prefix = prefix; this.handler.setPrefix(prefix); return _this(); }
/** * @param resolutionRequired the resolutionRequired. * @return the router spec. * @see AbstractMappingMessageRouter#setResolutionRequired(boolean) */ public RouterSpec<K, R> resolutionRequired(boolean resolutionRequired) { this.target.setResolutionRequired(resolutionRequired); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param prefix the prefix. * @return the router spec. * @see AbstractMappingMessageRouter#setPrefix(String) */ public RouterSpec<K, R> prefix(String prefix) { Assert.state(this.subFlows.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.prefix = prefix; this.target.setPrefix(prefix); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param prefix the prefix. * @return the router spec. * @see AbstractMappingMessageRouter#setPrefix(String) */ public RouterSpec<K, R> prefix(String prefix) { Assert.state(this.subFlows.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.prefix = prefix; this.target.setPrefix(prefix); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param suffix the suffix to set. * @return the router spec. * @see AbstractMappingMessageRouter#setSuffix(String) */ public RouterSpec<K, R> suffix(String suffix) { Assert.state(this.componentsToRegister.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.suffix = suffix; this.handler.setSuffix(suffix); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param suffix the suffix to set. * @return the router spec. * @see AbstractMappingMessageRouter#setSuffix(String) */ public RouterSpec<K, R> suffix(String suffix) { Assert.state(this.subFlows.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.suffix = suffix; this.target.setSuffix(suffix); return _this(); }
/** * Cannot be invoked if {@link #subFlowMapping(Object, IntegrationFlow)} is used. * @param suffix the suffix to set. * @return the router spec. * @see AbstractMappingMessageRouter#setSuffix(String) */ public RouterSpec<K, R> suffix(String suffix) { Assert.state(this.subFlows.isEmpty(), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); this.suffix = suffix; this.target.setSuffix(suffix); return _this(); }
/** * Set a limit for how many dynamic channels are retained (for reporting purposes). * When the limit is exceeded, the oldest channel is discarded. * <p><b>NOTE: this does not affect routing, just the reporting which dynamically * resolved channels have been routed to.</b> Default {@code 100}. * @param dynamicChannelLimit the limit. * @return the router spec. * @see AbstractMappingMessageRouter#setDynamicChannelLimit(int) */ public RouterSpec<K, R> dynamicChannelLimit(int dynamicChannelLimit) { this.handler.setDynamicChannelLimit(dynamicChannelLimit); return _this(); }
/** * @param key the key. * @param channelName the channelName. * @return the router spec. * @see AbstractMappingMessageRouter#setChannelMapping(String, String) */ public RouterSpec<K, R> channelMapping(K key, final String channelName) { Assert.notNull(key, "'key' must not be null"); Assert.hasText(channelName, "'channelName' must not be null"); if (key instanceof String) { this.handler.setChannelMapping((String) key, channelName); } else { this.mappingProvider.addMapping(key, new NamedComponent() { @Override public String getComponentName() { return channelName; } @Override public String getComponentType() { return "channel"; } }); } return _this(); }
/** * Add a subflow as an alternative to a {@link #channelMapping(Object, String)}. * {@link #prefix(String)} and {@link #suffix(String)} cannot be used when subflow * mappings are used. * @param key the key. * @param subFlow the subFlow. * @return the router spec. */ public RouterSpec<K, R> subFlowMapping(K key, IntegrationFlow subFlow) { Assert.notNull(key, "'key' must not be null"); Assert.notNull(subFlow, "'subFlow' must not be null"); Assert.state(!(StringUtils.hasText(this.prefix) || StringUtils.hasText(this.suffix)), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); DirectChannel channel = new DirectChannel(); IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel); subFlow.configure(flowBuilder); this.subFlows.add(flowBuilder); this.mappingProvider.addMapping(key, channel); return _this(); }
/** * @param key the key. * @param channelName the channelName. * @return the router spec. * @see AbstractMappingMessageRouter#setChannelMapping(String, String) */ public RouterSpec<K, R> channelMapping(K key, final String channelName) { Assert.notNull(key, "'key' must not be null"); Assert.hasText(channelName, "'channelName' must not be empty"); if (key instanceof String) { this.target.setChannelMapping((String) key, channelName); } else { this.mappingProvider.addMapping(key, new NamedComponent() { @Override public String getComponentName() { return channelName; } @Override public String getComponentType() { return "channel"; } }); } return _this(); }
/** * Add a subflow as an alternative to a {@link #channelMapping(Object, String)}. * {@link #prefix(String)} and {@link #suffix(String)} cannot be used when subflow * mappings are used. * @param key the key. * @param subFlow the subFlow. * @return the router spec. */ public RouterSpec<K, R> subFlowMapping(K key, IntegrationFlow subFlow) { Assert.notNull(key, "'key' must not be null"); Assert.notNull(subFlow, "'subFlow' must not be null"); Assert.state(!(StringUtils.hasText(this.prefix) || StringUtils.hasText(this.suffix)), "The 'prefix'('suffix') and 'subFlowMapping' are mutually exclusive"); DirectChannel channel = new DirectChannel(); IntegrationFlowBuilder flowBuilder = IntegrationFlows.from(channel); subFlow.configure(flowBuilder); this.subFlows.add(flowBuilder); this.mappingProvider.addMapping(key, channel); return _this(); }