2.3 Target

The Target interface defines a single method for sending Message objects.

public interface Target {
    boolean send(Message<?> message);
}

As with the Source, Spring Integration also provides a MethodInvokingTarget adapter class.

MethodInvokingTarget target = new MethodInvokingTarget();
target.setObject(new TargetObject());
target.setMethodName("targetMethod");
target.afterPropertiesSet();
target.send(new StringMessage("test"));

Likewise, the corresponding XML configuration is very similar to that of MethodInvokingSource.

<target-adapter id="target" ref="targetObject" method="targetMethod"/>