[resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

One Star

[resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

A first hello,
and many thanks for that great tool!

I'm just starting with Talend. Via tHttpRequest I want to fetch the content of an internet page. I can see the result in tLogRow. Now I want to add an tFileOutputRaw and just save the content to an file. How can/must I connect tFileOutputRaw to the other two components? 

Many thanks and greetings
TalentedFoxy

Accepted Solutions
Community Manager

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hi 
I get an error: "The schema from the input link "row2\" is different from the schema defined in the component."
Don't understand that error.

tFileOutputRaw has an predefined schema which has a column with Object type, but tHttpRequest returns a string, the output schema is different from the input schema. To resolve this error, add a tConvertType component between tHttpRequest and tFileOutputRaw to convert the data type. 
How can I connect components like
tHttpRequest-+-row1 (Main)-->tLogRow
                    \--row2 (Main)->tFileOutputRaw

tHttpRequest--main--tReplicate--main-->tLogRow
                                             --main--tConvertType--main-->tFileOutputRaw
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business

All Replies
Community Manager

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

To write the result to a text file, you can use tFileOutputDelimited, for example:
tHttpRequest--main--tFileOutputDelimited
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hello Shong,
many thanks for your answer.
I just want to save the content of tHttpRequest to a file (alternativly tLogRow). Therefore I want to use tFileOutputRaw. An HTML file isn't delimited in any way, so why I should use tFileOutputDelimited?
When I connect
tHttpRequest--row1 (Main)-->tLogRow--row2 (Main)->tFileOutputRaw
I get an error: "The schema from the input link "row2\" is different from the schema defined in the component."
Don't understand that error.
How can I connect components like
tHttpRequest-+-row1 (Main)-->tLogRow
                    \--row2 (Main)->tFileOutputRaw
By the way, I really miss simple "Hello World" examples like that one.

Many thanks and greetings
TalentedFoxy
Community Manager

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hi 
I get an error: "The schema from the input link "row2\" is different from the schema defined in the component."
Don't understand that error.

tFileOutputRaw has an predefined schema which has a column with Object type, but tHttpRequest returns a string, the output schema is different from the input schema. To resolve this error, add a tConvertType component between tHttpRequest and tFileOutputRaw to convert the data type. 
How can I connect components like
tHttpRequest-+-row1 (Main)-->tLogRow
                    \--row2 (Main)->tFileOutputRaw

tHttpRequest--main--tReplicate--main-->tLogRow
                                             --main--tConvertType--main-->tFileOutputRaw
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hello Shong,
due to your answer some progress, thanks for it.
But the file is empty. What are the settings in component tConvertType? I tried
"Autoconversion" (hope that's the correct translation).
tHttpRequest--row1 (Main)-->tLogRow--row2 (Main)->tConvertType--row3 (Main)->tFileOutputRaw
Traces Debug show
row 3 (Main) | Current row : 1
---------------+------------------
content        | null

Many thanks and greetings
TalentedFoxy
Community Manager

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hi
If you check the 'auto Cast' box, the output column name should be same as input column name, otherwise, uncheck the 'auto Cast' box and specify the input column and output column.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hello Shong,
many thanks for your support. My first talend* job is working now.
I (re)named the column row3 (main) via its scheme to ResponseContent. "Auto cast" is still checked.
Some additional questions:
1. Only the column ResponseContent in row1 (Main) is colored green, not the other ones (row2 (Main) and
row3 (Main)). What means the green color?
2. I thought that tLogRow contains all the messages of the Basic Run console like "Start Job XYZ...".
Is there a way to add these messages to the file?

Many thanks and greetings
TalentedFoxy
Community Manager

Re: [resolved] First job: tHttpRequest + tLogRow, then adding tFileOutputRaw

Hi
Glad to see you get it working!
1. Green color on the schema means it is a predefined schema by Talend, it is read-only.
2. You can activate log4j functionality to trace the log message and log them in a file, follows these steps:
a.)  Add "-DLOG4J_ENABLED=true" value in "Talend-Studio-win-x86_64.ini" or "TOS_DI-win32-x86.ini" depends on your machine.
b. )  Activate log4j functionality in the project settings panel.


c.) Change the default log4j template, for example:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="FILE" class="org.apache.log4j.FileAppender">
<param name="File" value="D:/${TalendJob.log}"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d - %c -%-4r %-5p %x - %m%n" />
</layout>
</appender>
<root>
<priority value="info" />
<appender-ref ref="FILE" />
</root>
</log4j:configuration>

In this example, it will log the message in a file called yourRealJobName.log under D:/.

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business