/** * Populate the {@link MessageChannel} name to the new {@link IntegrationFlowBuilder} chain. * The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}. * @param messageChannelName the name of existing {@link MessageChannel} bean. * The new {@link DirectChannel} bean will be created on context startup * if there is no bean with this name. * @return new {@link IntegrationFlowBuilder}. */ public static IntegrationFlowBuilder from(String messageChannelName) { return from(new MessageChannelReference(messageChannelName)); }
/** * Populate an {@link org.springframework.integration.channel.FixedSubscriberChannel} instance * at the current {@link IntegrationFlow} chain position. * The provided {@code messageChannelName} is used for the bean registration. * @param messageChannelName the bean name to use. * @return the current {@link IntegrationFlowDefinition}. */ public B fixedSubscriberChannel(String messageChannelName) { return channel(new FixedSubscriberChannelPrototype(messageChannelName)); }
/** * The factory method for the {@link DecodingTransformer}. * @param codec the {@link Codec} to use. * @param typeFunction the target type function. * @param <T> the target type. * @return the {@link DecodingTransformer} instance. * @since 1.2 */ public static <T> DecodingTransformer<T> decoding(Codec codec, Function<Message<?>, Class<T>> typeFunction) { return decoding(codec, new FunctionExpression<Message<?>>(typeFunction)); }
/** * Configure the {@code javaMailProperties} by invoking a {@link Consumer} callback which * is invoked with a {@link PropertiesBuilder}. * @param configurer the configurer. * @return the spec. * @see AbstractMailReceiver#setJavaMailProperties(Properties) */ public S javaMailProperties(Consumer<PropertiesBuilder> configurer) { PropertiesBuilder properties = new PropertiesBuilder(); configurer.accept(properties); return javaMailProperties(properties.get()); }
@SuppressWarnings("unchecked") private <S extends ConsumerEndpointSpec<S, ? extends MessageHandler>> B register(S endpointSpec, Consumer<S> endpointConfigurer) { if (endpointConfigurer != null) { endpointConfigurer.accept(endpointSpec); } MessageChannel inputChannel = this.currentMessageChannel; this.currentMessageChannel = null; if (inputChannel == null) { inputChannel = new DirectChannel(); this.registerOutputChannelIfCan(inputChannel); } Tuple2<ConsumerEndpointFactoryBean, ? extends MessageHandler> factoryBeanTuple2 = endpointSpec.get(); addComponents(endpointSpec.getComponentsToRegister()); if (inputChannel instanceof MessageChannelReference) { factoryBeanTuple2.getT1().setInputChannelName(((MessageChannelReference) inputChannel).getName()); } else { if (inputChannel instanceof FixedSubscriberChannelPrototype) { String beanName = ((FixedSubscriberChannelPrototype) inputChannel).getName(); inputChannel = new FixedSubscriberChannel(factoryBeanTuple2.getT2()); if (beanName != null) { ((FixedSubscriberChannel) inputChannel).setBeanName(beanName); } registerOutputChannelIfCan(inputChannel); } factoryBeanTuple2.getT1().setInputChannel(inputChannel); } return addComponent(endpointSpec).currentComponent(factoryBeanTuple2.getT2()); }
String channelName = null; if (outputChannel instanceof MessageChannelReference) { channelName = ((MessageChannelReference) outputChannel).getName();
public static MarshallingTransformer marshaller(Marshaller marshaller, ResultTransformer resultTransformer, ResultFactory resultFactory) { return marshaller(marshaller, resultTransformer, resultFactory, null); }
public static ObjectToJsonTransformer toJson(JsonObjectMapper<?, ?> jsonObjectMapper, ObjectToJsonTransformer.ResultType resultType) { return toJson(jsonObjectMapper, resultType, null); }
@Override public <T> T getValue(Class<T> desiredResultType) throws EvaluationException { return getValue(this.defaultContext, desiredResultType); }
@Override @SuppressWarnings("unchecked") public Object getValue(Object rootObject) throws EvaluationException { return this.function.apply((S) rootObject); }
public MailSendingMessageHandlerSpec javaMailProperties(Consumer<PropertiesBuilder> propertiesConfigurer) { PropertiesBuilder properties = new PropertiesBuilder(); propertiesConfigurer.accept(properties); return javaMailProperties(properties.get()); }
/** * The factory method for the {@link DecodingTransformer}. * @param codec the {@link Codec} to use. * @param typeFunction the target type function. * @param <T> the target type. * @return the {@link DecodingTransformer} instance. * @since 1.2 */ public static <T> DecodingTransformer<T> decoding(Codec codec, Function<Message<?>, Class<T>> typeFunction) { return decoding(codec, new FunctionExpression<Message<?>>(typeFunction)); }
/** * Populate a {@link MessageChannelReference} instance * at the current {@link IntegrationFlow} chain position. * The provided {@code messageChannelName} is used for the bean registration * ({@link org.springframework.integration.channel.DirectChannel}), if there is no such a bean * in the application context. Otherwise the existing {@link MessageChannel} bean is used * to wire integration endpoints. * @param messageChannelName the bean name to use. * @return the current {@link IntegrationFlowDefinition}. */ public B channel(String messageChannelName) { return channel(new MessageChannelReference(messageChannelName)); }
/** * Populate the {@link MessageChannel} name to the new {@link IntegrationFlowBuilder} chain. * Typically for the {@link org.springframework.integration.channel.FixedSubscriberChannel} together * with {@code fixedSubscriber = true}. * The {@link org.springframework.integration.dsl.IntegrationFlow} {@code inputChannel}. * @param messageChannelName the name for {@link DirectChannel} or * {@link org.springframework.integration.channel.FixedSubscriberChannel} * to be created on context startup, not reference. * The {@link MessageChannel} depends on the {@code fixedSubscriber} boolean argument. * @param fixedSubscriber the boolean flag to determine if result {@link MessageChannel} should * be {@link DirectChannel}, if {@code false} or * {@link org.springframework.integration.channel.FixedSubscriberChannel}, if {@code true}. * @return new {@link IntegrationFlowBuilder}. * @see DirectChannel * @see org.springframework.integration.channel.FixedSubscriberChannel */ public static IntegrationFlowBuilder from(String messageChannelName, boolean fixedSubscriber) { return fixedSubscriber ? from(new FixedSubscriberChannelPrototype(messageChannelName)) : from(messageChannelName); }
String channelBeanName = ((MessageChannelReference) component).getName(); if (!this.beanFactory.containsBean(channelBeanName)) { DirectChannel directChannel = new DirectChannel();
@Override public Object getValue(EvaluationContext context, Object rootObject) throws EvaluationException { return getValue(rootObject); }
@Override @SuppressWarnings("unchecked") public Object getValue(Object rootObject) throws EvaluationException { return this.function.apply((S) rootObject); }
/** * Configure the {@code javaMailProperties} by invoking a {@link Consumer} callback which * is invoked with a {@link PropertiesBuilder}. * @param configurer the configurer. * @return the spec. * @see ImapMailReceiver#setJavaMailProperties(Properties) */ public ImapIdleChannelAdapterSpec javaMailProperties(Consumer<PropertiesBuilder> configurer) { PropertiesBuilder properties = new PropertiesBuilder(); configurer.accept(properties); return javaMailProperties(properties.get()); }
@Override public <T> T getValue(Object rootObject, Class<T> desiredResultType) throws EvaluationException { return getValue(this.defaultContext, rootObject, desiredResultType); }
public MailSendingMessageHandlerSpec javaMailProperties(Consumer<PropertiesBuilder> propertiesConfigurer) { PropertiesBuilder properties = new PropertiesBuilder(); propertiesConfigurer.accept(properties); return javaMailProperties(properties.get()); }