INT-1849/INT-2147 Add Disposition to File Adapter
* Add *disposition-expression* to the inbound file adapter. This allows for operations such as *payload.delete()*, *payload.renameTo()* after the file is processed. * The result of executing the expression (if any) is sent to the disposition-result-channel.
This commit is contained in:
committed by
Gunnar Hillert
parent
703122a6fb
commit
066eb91100
@@ -39,7 +39,7 @@ import org.springframework.util.Assert;
|
||||
* @author Mark Fisher
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class MailReceivingMessageSource implements PseudoTransactionalMessageSource<javax.mail.Message> {
|
||||
public class MailReceivingMessageSource implements PseudoTransactionalMessageSource<javax.mail.Message, MailReceiverContext> {
|
||||
|
||||
private final Log logger = LogFactory.getLog(this.getClass());
|
||||
|
||||
@@ -77,17 +77,31 @@ public class MailReceivingMessageSource implements PseudoTransactionalMessageSou
|
||||
return null;
|
||||
}
|
||||
|
||||
public Object getResource() {
|
||||
public MailReceiverContext getResource() {
|
||||
return this.mailReceiver.getTransactionContext();
|
||||
}
|
||||
|
||||
public void afterCommit(Object context) {
|
||||
public void afterCommit(MailReceiverContext context) {
|
||||
Assert.isTrue(context instanceof MailReceiverContext, "Expected a MailReceiverContext");
|
||||
this.mailReceiver.closeContextAfterSuccess((MailReceiverContext) context);
|
||||
this.mailReceiver.closeContextAfterSuccess(context);
|
||||
}
|
||||
|
||||
public void afterRollback(Object context) {
|
||||
public void afterRollback(MailReceiverContext context) {
|
||||
Assert.isTrue(context instanceof MailReceiverContext, "Expected a MailReceiverContext");
|
||||
this.mailReceiver.closeContextAfterFailure((MailReceiverContext) context);
|
||||
this.mailReceiver.closeContextAfterFailure(context);
|
||||
}
|
||||
|
||||
/**
|
||||
* For backwards-compatibility; the mail adapter updates the status before the send.
|
||||
*/
|
||||
public void afterReceiveNoTx(MailReceiverContext resource) {
|
||||
this.afterCommit(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* For backwards-compatibility; the mail adapter updates the status before the send.
|
||||
*/
|
||||
public void afterSendNoTx(MailReceiverContext resource) {
|
||||
// No op
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user