/** * Populate a {@link DelayHandler} to the current integration flow position. * @param groupId the {@code groupId} for delayed messages in the * {@link org.springframework.integration.store.MessageGroupStore}. * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. * @return the current {@link IntegrationFlowDefinition}. * @see DelayerEndpointSpec */ public B delay(String groupId, Consumer<DelayerEndpointSpec> endpointConfigurer) { return register(new DelayerEndpointSpec(new DelayHandler(groupId)), endpointConfigurer); }
/** * Configure a list of {@link Advice} objects that will be applied, in nested order, * when delayed messages are sent. * @param advice the advice chain. * @return the endpoint spec. */ public DelayerEndpointSpec delayedAdvice(Advice... advice) { this.delayedAdvice.addAll(Arrays.asList(advice)); return _this(); }
@Bean public IntegrationFlow delayFlow() { return flow -> flow .delay(GROUP_ID, e -> e .messageStore(messageGroupStore) .id("delayer")) .channel(MessageChannels.queue("delayedResults")); }
@Bean public IntegrationFlow bridgeFlow2() { return IntegrationFlows.from("bridgeFlow2Input") .bridge(c -> c.autoStartup(false).id("bridge")) .fixedSubscriberChannel() .delay("delayer", d -> d .delayExpression("200") .advice(this.delayedAdvice) .messageStore(this.messageStore())) .channel(MessageChannels.queue("bridgeFlow2Output")) .get(); }
@Bean public IntegrationFlow bridgeFlow2() { return IntegrationFlows.from("bridgeFlow2Input") .bridge(c -> c.autoStartup(false).id("bridge")) .fixedSubscriberChannel() .delay("delayer", "200", c -> c.advice(this.delayedAdvice).messageStore(this.messageStore())) .channel(c -> c.queue("bridgeFlow2Output")) .get(); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} for the * {@link org.springframework.messaging.MessageHandler}. * @param transactionInterceptor the {@link TransactionInterceptor} to use. * @return the spec. * @see TransactionInterceptorBuilder * @since 5.0.8 */ public DelayerEndpointSpec transactionalRelease(TransactionInterceptor transactionInterceptor) { return delayedAdvice(transactionInterceptor); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} with the provided * {@code PlatformTransactionManager} and default * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} * for the {@link org.springframework.messaging.MessageHandler}. * @param transactionManager the {@link PlatformTransactionManager} to use. * @return the spec. * @since 5.0.8 */ public DelayerEndpointSpec transactionalRelease(PlatformTransactionManager transactionManager) { return transactionalRelease( new TransactionInterceptorBuilder() .transactionManager(transactionManager) .build()); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} with default * {@link PlatformTransactionManager} and * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} for * the * {@link org.springframework.messaging.MessageHandler}. * @return the spec. * @since 5.0.8 */ public DelayerEndpointSpec transactionalRelease() { TransactionInterceptor transactionInterceptor = new TransactionInterceptorBuilder().build(); this.componentsToRegister.put(transactionInterceptor, null); return delayedAdvice(transactionInterceptor); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} with the provided * {@code PlatformTransactionManager} and default * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} * for the {@link org.springframework.messaging.MessageHandler}. * @param transactionManager the {@link PlatformTransactionManager} to use. * @return the spec. * @since 5.0.8 */ public DelayerEndpointSpec transactionalRelease(PlatformTransactionManager transactionManager) { return transactionalRelease( new TransactionInterceptorBuilder() .transactionManager(transactionManager) .build()); }
/** * @param defaultDelay the defaultDelay. * @return the endpoint spec. * @see DelayHandler#setDefaultDelay(long) */ public DelayerEndpointSpec defaultDelay(long defaultDelay) { this.handler.setDefaultDelay(defaultDelay); return _this(); }
private B delay(String groupId, Expression expression, Consumer<DelayerEndpointSpec> endpointConfigurer) { DelayHandler delayHandler = new DelayHandler(groupId); if (expression != null) { delayHandler.setDelayExpression(expression); } return this.register(new DelayerEndpointSpec(delayHandler), endpointConfigurer); }
@Bean public IntegrationFlow delayFlow() { return flow -> flow.delay(GROUP_ID, (String) null, e -> e.messageStore(messageGroupStore).id("delayer")) .channel(c -> c.queue("delayedResults")); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} for the * {@link org.springframework.messaging.MessageHandler}. * @param transactionInterceptor the {@link TransactionInterceptor} to use. * @return the spec. * @see TransactionInterceptorBuilder * @since 5.0.8 */ public DelayerEndpointSpec transactionalRelease(TransactionInterceptor transactionInterceptor) { return delayedAdvice(transactionInterceptor); }
/** * @param messageStore the message store. * @return the endpoint spec. */ public DelayerEndpointSpec messageStore(MessageGroupStore messageStore) { this.handler.setMessageStore(messageStore); return _this(); }
/** * Populate a {@link DelayHandler} to the current integration flow position. * @param groupId the {@code groupId} for delayed messages in the * {@link org.springframework.integration.store.MessageGroupStore}. * @param endpointConfigurer the {@link Consumer} to provide integration endpoint options. * @return the current {@link IntegrationFlowDefinition}. * @see DelayerEndpointSpec */ public B delay(String groupId, Consumer<DelayerEndpointSpec> endpointConfigurer) { return register(new DelayerEndpointSpec(new DelayHandler(groupId)), endpointConfigurer); }
/** * Specify a {@link TransactionInterceptor} {@link Advice} with default * {@link PlatformTransactionManager} and * {@link org.springframework.transaction.interceptor.DefaultTransactionAttribute} for * the * {@link org.springframework.messaging.MessageHandler}. * @return the spec. * @since 5.0.8 */ public DelayerEndpointSpec transactionalRelease() { TransactionInterceptor transactionInterceptor = new TransactionInterceptorBuilder().build(); this.componentsToRegister.put(transactionInterceptor, null); return delayedAdvice(transactionInterceptor); }
/** * @param ignoreExpressionFailures the ignoreExpressionFailures. * @return the endpoint spec. * @see DelayHandler#setIgnoreExpressionFailures(boolean) */ public DelayerEndpointSpec ignoreExpressionFailures(boolean ignoreExpressionFailures) { this.handler.setIgnoreExpressionFailures(ignoreExpressionFailures); return _this(); }
private B delay(String groupId, Expression expression, Consumer<DelayerEndpointSpec> endpointConfigurer) { DelayHandler delayHandler = new DelayHandler(groupId); if (expression != null) { delayHandler.setDelayExpression(expression); } return this.register(new DelayerEndpointSpec(delayHandler), endpointConfigurer); }
/** * Configure a list of {@link Advice} objects that will be applied, in nested order, * when delayed messages are sent. * @param advice the advice chain. * @return the endpoint spec. */ public DelayerEndpointSpec delayedAdvice(Advice... advice) { this.delayedAdvice.addAll(Arrays.asList(advice)); return _this(); }
/** * Configure a list of {@link Advice} objects that will be applied, in nested order, * when delayed messages are sent. * @param advice the advice chain. * @return the endpoint spec. */ public DelayerEndpointSpec delayedAdvice(Advice... advice) { this.delayedAdvice.addAll(Arrays.asList(advice)); return _this(); }