Last Updated: February 25, 2016
·
804
· apr

DirPoll Example

Configuration

<dir-poll class="org.jpos.q2.iso.DirPollAdaptor" logger="Q2">
    <attr name="path">spool/myspool</attr>
    <attr name="priorities">.txt</attr>
    <attr name="poolSize" type="java.lang.Integer">1</attr>
    <attr name="pollInterval" type="java.lang.Long">5000</attr>
    <attr name="processor">your.dirpoll.Processor</attr>

    <property name="archive" value="true" />
    <property name="archive.timestamp" value="true" />
</dir-poll> 

Sample FileProcessor

public class Processor implements DirPoll.FileProcessor
    public void process(File file) throws DirPoll.DirPollException {
        // do something with the file
    }
}

Sample Processor

public class Processor implements DirPoll.Processor
    public byte[] process(String name, byte[] request)
                         throws DirPollException {
        // process the request, create a response
         return yourResponse;
    }
}