mercredi 13 mai 2015

Messaging Gateway Adapter Pattern in Spring Integration

i am trying to apply Matt Vickery's Messaging Gateway Adapter Pattern, but I am having difficulty figuring out how to trigger gateway from the service activator. Here is my configuration:

<bean id="submitFileLs"
        class="org.springframework.integration.ftp.gateway.FtpOutboundGateway">
    <constructor-arg name="sessionFactory" ref="ftpClientFactory" />
    <constructor-arg name="command" value="ls" />
    <constructor-arg name="expression" value="headers['ackDir']" />
</bean>

And here is my activator code:

public class SubmitFileHandler {
    private FtpOutboundGateway lsGateway;

    @ServiceActivator
    public Message<?> checkForSubmitFile(Message<?> message) {
        lsGateway.setOptions("-1");
        //trigger lsGateway HERE

        return null;//will be based on gateway return value
    }

    public final void setLsGateway(FtpOutboundGateway lsGateway) {
        this.lsGateway = lsGateway;
    }    
}

Is there a way to do it or am I getting the whole concept wrong? Thanks.

Aucun commentaire:

Enregistrer un commentaire