Right now, my problem is that if the email fails I know it has failed, but the only way for me to know why os to look at the logs.....
public class MailSource extends AbstractStreamWriteableSource implements WriteableSource {
public MailSource( ComponentManager manager ) { super(manager); } public InputStream getInputStream() { return null; } public OutputStream getOutputStream() { return new MessageBuffer(); } public String getSystemId() { return "Email Source"; }
class MessageBuffer extends ByteArrayOutputStream {
public void close() throws IOException {
super.close();
try {
Properties props = new Properties();
props.put( "mail.transport.protocol", "smtp" );
props.put( "mail.smtp.host", "localhost" );
Session mailSession = Session.getInstance( props, null );
MimeMessage mimeMessage = new MimeMessage( mailSession, new ByteArrayInputStream( toByteArray() ) );
Transport.send( mimeMessage );
} catch ( Exception e ) {
getLogger().error("Error sending email", e );
throw new IOException( "Unable to send email" );
}
}
}
}
If you have any ideas!(even if it involves changing the way I am thinking of doing this)
Ciao
Eric
What happens if your source just throws something like a ProcessingException when
it comes across an error. How does the SourceWritingTransformer handle that?
Regards, Upayavira
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]