Hello Nick,
I moved on a little bit - at least I think I moved on.....
Now I changed the coding to this:
Payload payload = msg.createPayload();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"empty payload created");
byte[] binbytearray = convert(bis);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"byte array created");
payload.setContent(binbytearray);
payload.setName(Filename);
String localname = payload.getName();
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"file name set: "+localname);
msg.addAttachment(payload);
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"payload attachment added");
My "convert" method that creates the byte Array looks like this:
public byte[] convert(InputStream is) {
byte[] buff = new byte[1024];
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
byte[] byteArray=null;
try {
int n;
while ((n = is.read(buff)) >= 0) {
buffer.write(buff, 0, n);
}
buffer.flush();
byteArray = buffer.toByteArray();
} catch (Exception e) {
e.printStackTrace();
}
return byteArray;
}
Does my Java code look better??
In the RWB it looks good to me - I have 2 payloads - one is the trigger file - the other is the JPEG File I hope. It looks like this:
But the receiver only receives the trigger file.
And actually the trigger file should be replaced by the attachment. The receiver is an FTP Receiver channel - do I need to use "PayloadSwapBean"?
Best regards,
Peter
