Manually firing off the trigger "On Component Error" from a tJavarow

Four Stars

Manually firing off the trigger "On Component Error" from a tJavarow

I would like to error out a tJavaRow with a condition in my code,  is that possible to fire off the "On Component Error" with code?
Moderator

Re: Manually firing off the trigger "On Component Error" from a tJavarow

Hi,
The Java code of the tJavaRow will be executed for each row. The tJavaRow is normally used as an intermediary component.
For your use case, you can use tJava component which is used to execute a piece of Java code as a separate subjob in most cases. The Java code will be executed only once.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Manually firing off the trigger "On Component Error" from a tJavarow

Am I missing something. The answer does not actually answer the question!

I also have a tJavaRow that gets information from a web service for each record that goes through it.

Is I get an error from the web service or it becomes unavailable I want to trigger an alternate execution path through a On Component error.

 

So how do I trigger this On Component error?

Nine Stars

Re: Manually firing off the trigger "On Component Error" from a tJavarow

Hello

Which component you are using to fetch webservice ? If webservice failes you could attach onComponentError to it.

On tjavarow , you could throw runtime Exception to trigger oncomponenterror
E.g
throw new Exception(“manual error”)
Or int x = 10/a
If error , a=0 otherwise a=1
Regards
Abhishek KUMAR

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download