Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Reading java or protobuf object

I have a senario where I recieve real time java or protobuf objects. I need to extract data from those object and store into database. Is there a way in Talend where I can take java object as input and extract fields of that object.
Labels (3)
20 Replies
Anonymous
Not applicable
Author

routine returns string. How to use my routine in tFixedFlowInput.
my Routine is --
public class ReadObject {

public static String getString(Object obj) {
String str=objectToString(obj);
return str;
}
public static String objectToString(Object obj)
{
StringBuilder result = new StringBuilder();
StringBuilder result1 = new StringBuilder();

Field[] fields = obj.getClass().getDeclaredFields();
//print field names paired with their values
for ( Field field : fields ) {
try {
result.append( field.getName() );
result.append(",");
//requires access to private field:
field.setAccessible(true);
result1.append( field.get(obj) );
result1.append(",");
}
catch ( IllegalAccessException ex ) {
System.out.println(ex);
}

}
result.append("\n");
result.append(result1);
return result.toString();
}
}
Anonymous
Not applicable
Author

Hello
Please see my screenshot.
Best regards
Shong
Anonymous
Not applicable
Author

I want to use this code outside talend in my eclipse which will call this piece of code to pass object.how can I use this code outside talend.
Anonymous
Not applicable
Author

Hello
You can write this piece of code in Eclipse and pass the return string to talend job. See
5932
5658
Best regards
Shong
Anonymous
Not applicable
Author

Shong Thx for your valuable help. It really helped me. I want to know one more thing in tFixedflowInput we specify value as routine method. but i want to ReadObject.getString(new Person("shaky", "15")); should get object from outside talend. In eclipse I should also able to pass object to getString() method
Anonymous
Not applicable
Author

Hello
ReadObject.getString(new Person("shaky", "15")); should get object from outside talend. In eclipse I should also able to pass object to getString() method

Why don't you write getString() method in eclipse and call it in eclipse, return a string and pass string to talend job?
Best regards
Shong
Anonymous
Not applicable
Author

In my design, i get real time object from various networks. I have to pass these object directly to talend job which will perform ETL. That is why I was trying to take java object as input to the talend job. It should be talend job to extract data from object. I need solution around this.
Anonymous
Not applicable
Author

Hello
I want to use this code outside talend in my eclipse which will call this piece of code to pass object.how can I use this code outside talend.

But you said that you want to call this piece of code in Eclipse, outside Talend.
Best regards
Shong
Anonymous
Not applicable
Author

ya, so that I can pass my objects to this talend thorugh another application.
Anonymous
Not applicable
Author

I failed to find any solution to pass java object to talend input from outside. Please give me some solution for this. Or for time being how can I pass string to talend input from outside Talend.