0

Hi i have a requirement to launch the spring batch job when there is a message in to the queue and once processing done i need to return some message back to Queue . I am using Spring integration and in Service activator i am able to receive the message from input channel and i am using JmsTemplate to send back response to queue once processing is done. Is this the right way to do it in Spring integration

1 Answers1

0

Use a JobLaunchingGateway from spring-batch-integration...

@Bean
@ServiceActivator(inputChannel = "...", outputChannel = "...")
public JobLaunchingGateway gateway() {
    return new JobLaunchingGateway(...);
}

The JobExcecution will be sent to the output channel.

See the documentation.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179