0

I have below requirements,

  1. Receiving file from diff systems and convert into JMS text message and send to IBM MQ
  2. Receiving message from IBM MQ and store into database.
  3. Display status of the messages and files with file name and timestamp in GUI.. I am planning to use spring batch to achieve solutions for this requirement ... All my messages and files needs to be triggered on real time (system should process immediately once the file arrived ). So I am planning to use spring integration ( message inbound and file inbound adaptors ).. So the listener will listen files in the queue and trigger the batch job once it arrived and the batch will convert the message into XML text and send to IBM MQ. now I want to stop the listener if there is any error happen during parsing or transmission .. Similar way I want to start the listener once issue is resolved.. What would be recommended solution for this issue ??
Gary Russell
  • 166,535
  • 14
  • 146
  • 179
Raj GT
  • 25
  • 2
  • 8

1 Answers1

0

You can use a control bus - give the adapter an id, say myAdapter, then send @myAdapter.stop() and @myAdapter.start() to the control bus channel.

Alternatively, you can autowire the adapter as a LifeCycle and call stop()/start() explicitly.

Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • Thank you for the Suggestion Gary. I am planning to show the listener status in GUI along with start and stop option. Can control bus would be recommended option to handle this kind of scenarios. – Raj GT Jul 15 '16 at 03:36
  • `Lifecycle` has another method `isRunning()` - you can use a control bus called from a Messaging Gateway to get the current state or call `isRunning()` directly on the endpoint. – Gary Russell Jul 15 '16 at 08:36