ULTRAESB - Poll a directory for a file with a specific pattern and upload it with an authenticated HTTP PUT

<u:proxy id="file-proxy">
    <u:transport id="file">
        <u:property name="url" value="file:///hunt/pixmania/orders/incoming"/>
        <u:property name="fileNamePattern" value=".*\.pxml"/>
        <u:property name="startDelay" value="1000"/>
        <u:property name="repeatInterval" value="1000"/>
        <!--<u:property name="concurrent" value="true"/>-->
        <!--<u:property name="cronExpression" value="0 * * ? * MON-FRI"/>-->
        <u:property name="moveAfterProcess" value="/hunt/pixmania/orders/processed"/>
        <u:property name="moveAfterFailure" value="/hunt/pixmania/orders/failed"/>
        <u:property name="moveTimestampFormat" value="yyyy_MM_dd_'T'HH_mm_ss.SSSSZ"/>
    </u:transport>
    <u:target>
        <u:inSequence>
            <u:java><![CDATA[
                String fileName = msg.getFirstTransportHeader("FileName");
                System.out.println("Got file : " + fileName);
                mediation.addPreemptiveBasicAuthentication(msg, "trevor", "password");
                msg.setContentType("text/xml");
                msg.addMessageProperty("HTTP_METHOD", "PUT");
            ]]></u:java>
        </u:inSequence>
        <u:inDestination>
            <u:address>http://192.168.0.1:7800/ProcessOrders/SubmitOrder</u:address>
        </u:inDestination>
    </u:target>
</u:proxy>

Comments

Post a Comment

Popular posts from this blog

Basic Send Message to MQ with Java and IBM MQ JMS

Basic Receive Message to MQ with Java and IBM MQ JMS

Configure Database Connection using MyBatis