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?

Eleven 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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch