File Generator Connector
hello , I create one custom connector for generate PDFs file after task completed . for initial test i dnt take any input for this when i execute process connector not executed pro pare it goes to failed stage . how can i recover and how can i show error .
Pl see following detail :
- in Connector defination : no input , no output
- Connector implementation : following code which just create simple pdf file .
/**
*
*/
package org.mycompany.connector;
import org.bonitasoft.engine.connector.ConnectorException;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.FileOutputStream;
public class GeneratePDFImpl extends AbstractGeneratePDFImpl {
Document document = new Document();
@Override
protected void executeBusinessLogic() throws ConnectorException{
try{
PdfWriter.getInstance(document, new FileOutputStream("ThisisTest.pdf"));
document.add(new Paragraph("A Hello World PDF document."));
}
catch(Exception e)
{
throw new ConnectorException(e);
}
}
@Override
public void connect() throws ConnectorException{
document.open();
}
@Override
public void disconnect() throws ConnectorException{
document.close();
}
}
*
*/
package org.mycompany.connector;
import org.bonitasoft.engine.connector.ConnectorException;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.FileOutputStream;
public class GeneratePDFImpl extends AbstractGeneratePDFImpl {
Document document = new Document();
@Override
protected void executeBusinessLogic() throws ConnectorException{
try{
PdfWriter.getInstance(document, new FileOutputStream("ThisisTest.pdf"));
document.add(new Paragraph("A Hello World PDF document."));
}
catch(Exception e)
{
throw new ConnectorException(e);
}
}
@Override
public void connect() throws ConnectorException{
document.open();
}
@Override
public void disconnect() throws ConnectorException{
document.close();
}
}
1 answer
Hi,
for error recovering of a connector execution, you need to use the Subscription version.
Are you sure that the "ThisisTest.pdf" file is the jar of the connector? Are yoiu sure that you can call .open() on a Document that created without parameter?
The logs are available in engine logs: Help--> SHow engine logs.
Regards,
Comments
Do you get a stacktrace in the engine logs?
I don't know how to get , severlogs .