0

Sorry this might sound naive to JMS gurus, but still.

I have a requirement where a Spring based application is not able to connect synchronously to a SAP back-end (via their web-service interface) because the response from SAP is way too slow. We are thinking of a solution where the updates from GUI would be saved by the Spring middle-ware in a local database, simultaneously sending a message to a JMS queue. We want that after (say) every few hours (or may be nightly) a batch job runs to consume the message from the JMS queue, and based on the message contents, queries on the local database and sends the result to the SAP web-service.

Is this approach correct? Would I need a batch to trigger the JMS message consumption (because I don't want to consume the message immediately but in a deferred manner and at a pre-decided time)? Is there any way in Spring to implement this gracefully (like Camel)? Appreciate your help.

Dchucks
  • 1,189
  • 5
  • 22
  • 48

1 Answers1

0

Spring Batch has a JmsItemReader that can be used in a batch program; an empty queue signals the end of the batch. Spring Cloud Task is built on top of batch and can be used for cloud deployments.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Sorry but mine is an OnPrem application. What I really want to know is the mechanism by which a JMS message queue can be consumed in a deferred manner (asynchronously and at a pre-determined time). – Dchucks Jun 23 '18 at 11:12
  • So, as I said, write a Spring Batch application; you can schedule it to run (a) with an enterprise scheduler, (b) as a cron job or (c) from a Spring Integration app using a cron-based poller. See the documentation. I mentioned spring-cloud-task in case other readers are interested in cloud-based deployments (public or on-prem). – Gary Russell Jun 23 '18 at 14:33