How the JMSReader stops execution of the graph? Does it stop once it cannot retrieve any message from the queue? Or do we have any method to stop processing once we can ascertain that all the records have been processed? What is recommended method to deal with this process?
The JMS Reader component has 3 common use cases:
-
When you specify a time-out, the JMS Reader reads all the messages from the queue and ends only when no message can be read within the time-out limit. You could use this to run the final graph that would process all JMS messages (that are currently present) and end. This graph would have to be started periodically to process new messages.
-
When you specify a 0 time-out, the JMS Reader component never ends. It waits on the queue forever and receives new messages. This way you can create a “forever” running graph which processes new JMS messages at the time they arrive.
-
Finally you can specify a processorClass or processorCode (in-line Java source in the component). The processor is a Java class implementing the JmsMsg2DataRecord interface. The interface has a boolean endOfInput() method which can indicate that all input has been processed.
So in the end it depends whether you can have a “forever” running graph (as in the scenario 2), which is probably the most used solution. If you cannot have such a graph, you can use the remaining 2 solutions.