Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-4521

Consider adding more Pollers factory methods

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Documentation, DSL

      Description

      For example:

      @Bean
      public IntegrationFlow flow(ConnectionFactory connectionFactory) {
      	return IntegrationFlows.from(Jms.inboundAdapter(connectionFactory)
      					.destination("foo"), e -> e
      						.poller(poller(connectionFactory)))
      			.handle((p, h) -> {
      				try {
      					Thread.sleep(2000);
      				}
      				catch (InterruptedException e1) {
      					Thread.currentThread().interrupt();
      				}
      				throw new RuntimeException("foo");
      			})
      			.get();
      }
      
      @Bean
      public JmsTransactionManager tm(ConnectionFactory cf) {
      	return new JmsTransactionManager(cf);
      }
      
      @Bean
      public PollerMetadata poller(ConnectionFactory cf) {
      	PollerMetadata poller = new PollerMetadata();
      	poller.setTrigger(new PeriodicTrigger(5000));
      	List<Advice> adviceList = new ArrayList<>();
      	adviceList.add(new TransactionInterceptor(tm(cf), new MatchAlwaysTransactionAttributeSource()));
      	poller.setAdviceChain(adviceList);
      	poller.setMaxMessagesPerPoll(2);
      	return poller;
      }
      

        Attachments

          Activity

            People

            Assignee:
            abilan Artem Bilan
            Reporter:
            grussell Gary Russell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: