0
votes

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

1 Answers

0
votes

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.