Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
In the documentation of the tRabbitMQInput component ( here ), we can read the following limitation :
Normally, this component works in the streaming mode and will not stop unless an error or an exception occurs. So, when you add this component to a Job, make sure that the Job has a mechanism that can interrupt the execution of this component.
What could be such a mechanism ?
Nearby... you can use tJavaRow within the flow and add here some code with an if condition and use break to to the flow. Please take care all input columns are handover to the output schema.
In fact Talend has currently no mechanism to gracefully shutdown a job.
Hi
Define a condition based on the data retrieved from queue on tJavaRow, use 'break' command to stop the component execution once the condition is met. eg:
tRabbitMQInput--main--tJavaRow--main--tLogRow
|onsubjobok
other components
on tJavaRow:
output_row.columnName=input_row.columName;
if(input_row.columnName.equals("talend")){
break;
}
Can you try?
Using Die and check 'exit JVM immediatel' will kill the JVM and stop the job execution.
Regards
Shong
Hello @Shicong Hong and @Jan Lolling
Thanks for your reply
To give you more details, we are trying to change the initial behavior of the tRabbitMQInput component, so that it is not used as a stream but as a classic row component (like a tDBInput for example).
So, this solution is not possible for us, cause we need to use tRabbitMQAck component to acknowledge messages one by one.
And this component does not accept row input, only onComponentOk/onSubJobOk or iterate. And as you know, we can't use break without row input
Also, if we had a clearer solution to cleanly stop a job at a chosen time without crashing the parent job (like a tDie or a system.exit, that would be ideal for us. We can indeed use if conditions to decide whether to continue processing or not, but it is a solution of last resort
You can use the component tFlowToIterate to convert the flow into a iterate trigger.
Sûre, I know, but you can't use the break in an iterate, cause it's not the same loop as row