Help get this topic noticed by sharing it on Twitter, Facebook, or email.

File Transport from Mule 3

I am developing an application with mule3. I have couple of question with regards to file transport.

1. Is there anyway to filter the files depending on the size ? I would like to pick the files which size are garter than particular size.

2. mule-config details are given below. how can I get the input object as file. According to the following configuration. it passed org.mule.transport.file.ReceiverFileInputStream object instead of file object.
Is it possible to get the file object from getPaylod method from MuleMessage object.

<file:connector name="inboundFileConnector"
pollingFrequency="5000" autoDelete="false"
moveToPattern="#function:datestamp:yyyy-MM-dd_HH-mm-ss--#function:count-#header:originalFilename">
<service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
<file:expression-filename-parser />
</file:connector>

<model name="MyModel">
<service name="FileService">
<inbound>+
<file:inbound-endpoint connector-ref="inboundFileConnector"
path="C:/temp/filewatcher/inbox" moveToDirectory="C:/temp/filewatcher/history">
<file:filename-wildcard-filter pattern=".txt,.pdf" caseSensitive="false" />
</file:inbound-endpoint>
</inbound>

<component class="org.TestFileTransport" />
<outbound>
<pass-through-router>
<stdio:outbound-endpoint system="IN" />
</pass-through-router>
</outbound>
</service>
</model>

Thanks in advance.

Edited by: Thilan Saba on Feb 27, 2011 10:44 PM
1 person has
this question
+1
Reply
  • *Message imported, originaly posted: Mon, 28 Feb 2011 00:44:36 .
    I am developing an application with mule3. I have couple of question with regards to file transport.

    1. Is there anyway to filter the files depending on the size ? I would like to pick the files which size are garter than particular size.

    2. mule-config details are given below. how can I get the input object as file. According to the following configuration. it passed org.mule.transport.file.ReceiverFileInputStream object instead of file object.
    Is it possible to get the file object from getPaylod method from MuleMessage object.

    <file:connector name="inboundFileConnector"
    pollingFrequency="5000" autoDelete="false"
    moveToPattern="#function:datestamp:yyyy-MM-dd_HH-mm-ss--#function:count-#header:originalFilename">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
    <file:expression-filename-parser />
    </file:connector>

    <model name="MyModel">
    <service name="FileService">
    <inbound>+
    <file:inbound-endpoint connector-ref="inboundFileConnector"
    path="C:/temp/filewatcher/inbox" moveToDirectory="C:/temp/filewatcher/history">
    <file:filename-wildcard-filter pattern=".txt,.pdf" caseSensitive="false" />
    </file:inbound-endpoint>
    </inbound>

    <component class="org.TestFileTransport" />
    <outbound>
    <pass-through-router>
    <stdio:outbound-endpoint system="IN" />
    </pass-through-router>
    </outbound>
    </service>
    </model>

    Thanks in advance.

    Edited by: Thilan Saba on Feb 27, 2011 10:44 PM
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Mon, 28 Feb 2011 02:58:06 .
    On 02/28/2011 07:45 AM, Thilan Saba wrote:
    I am developing and application with mule3.
    I have couple of question with regards to file transport.
    1. Is there anyway to filter the files depending on the size.

    Configure a filter on the endpoint. It will be used when polling the
    directory.

    2. mule-config details are given below. how can I get the input
    object as file. According to the following configuration. it passed
    org.mule.transport.file.ReceiverFileInputStream object instead of
    file object. Is it possible to get the file object from getPaylod
    method from MuleMessage object.

    Did you turn off streaming on the endpoint? IIRC it's enabled by default.

    -dirk




  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Mon, 28 Feb 2011 18:42:25 .
    Thanks for your hints and time Dirk.

    I am not clear about configuring filter at end bound.
    I want to read the files which are greater than configured size ( eg. Grater than 3 MegaBytes).
    Can you able to highlight any example
    Currently, payload method returns File object instead of ReceiverFileInputStream.
    Extract from config file given below, I hope this will helpful to someone.

    <file:connector name="inboundFileConnector" pollingFrequency="10000" autoDelete="false" streaming="false" moveToPattern="#function:datestamp:yyyy-MM-dd_HH-mm-ss--#function:count-#header:originalFilename">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" inboundTransformer="org.mule.transformer.NoActionTransformer" />
    <file:expression-filename-parser />
    </file:connector>

    <model name="MyModel">
    <service name="FileService">
    <inbound>
    <file:inbound-endpoint connector-ref="inboundFileConnector" disableTransportTransformer="true" path="C:/temp/filewatcher/inbox" fileAge="10000" moveToDirectory="C:/temp/filewatcher/history">
    <file:filename-wildcard-filter pattern=".txt,.pdf" caseSensitive="false" />
    </file:inbound-endpoint>
    </inbound>

    <component class="org.TestFileTransport" />
    <outbound>
    <pass-through-router>
    <stdio:outbound-endpoint system="IN" />
    </pass-through-router>
    </outbound>
    </service>
    </model>

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Tue, 01 Mar 2011 02:16:25 .
    On 03/01/2011 01:42 AM, Thilan Saba wrote:
    Thanks for your hints and time Dirk.
    I am not clear about configuring filter at end bound.


    This is what I meant:

    <file:inbound-endpoint connector-ref="inboundFileConnector"
    disableTransportTransformer="true" path="C:/temp/filewatcher/inbox"
    fileAge="10000" moveToDirectory="C:/temp/filewatcher/history">
    <and-filter>
    <custom-filter class="your.custom.filesize.Filter"/>
    <file:filename-wildcard-filter pattern=".txt,.pdf"
    caseSensitive="false" />
    </and-filter>
    </file:inbound-endpoint>

    your.custom.filesize.Filter would need to implement
    org.mule.api.routing.filter.Filter and java.io.FileFilter (yes, I know,
    it's strange that you must implement both filters ...)

    -dirk




  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Mon, 07 Mar 2011 16:52:57 .
    Thanks for your detail explanation Dirk.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Tue, 01 Mar 2011 02:16:25 .
    On 03/01/2011 01:42 AM, Thilan Saba wrote:
    Thanks for your hints and time Dirk.
    I am not clear about configuring filter at end bound.


    This is what I meant:

    <file:inbound-endpoint connector-ref="inboundFileConnector"
    disableTransportTransformer="true" path="C:/temp/filewatcher/inbox"
    fileAge="10000" moveToDirectory="C:/temp/filewatcher/history">
    <and-filter>
    <custom-filter class="your.custom.filesize.Filter"/>
    <file:filename-wildcard-filter pattern=".txt,.pdf"
    caseSensitive="false" />
    </and-filter>
    </file:inbound-endpoint>

    your.custom.filesize.Filter would need to implement
    org.mule.api.routing.filter.Filter and java.io.FileFilter (yes, I know,
    it's strange that you must implement both filters ...)

    -dirk
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Mon, 28 Feb 2011 18:42:25 .
    Thanks for your hints and time Dirk.

    I am not clear about configuring filter at end bound.
    I want to read the files which are greater than configured size ( eg. Grater than 3 MegaBytes).
    Can you able to highlight any example
    Currently, payload method returns File object instead of ReceiverFileInputStream.
    Extract from config file given below, I hope this will helpful to someone.

    <file:connector name="inboundFileConnector" pollingFrequency="10000" autoDelete="false" streaming="false" moveToPattern="#function:datestamp:yyyy-MM-dd_HH-mm-ss--#function:count-#header:originalFilename">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" inboundTransformer="org.mule.transformer.NoActionTransformer" />
    <file:expression-filename-parser />
    </file:connector>

    <model name="MyModel">
    <service name="FileService">
    <inbound>
    <file:inbound-endpoint connector-ref="inboundFileConnector" disableTransportTransformer="true" path="C:/temp/filewatcher/inbox" fileAge="10000" moveToDirectory="C:/temp/filewatcher/history">
    <file:filename-wildcard-filter pattern=".txt,.pdf" caseSensitive="false" />
    </file:inbound-endpoint>
    </inbound>

    <component class="org.TestFileTransport" />
    <outbound>
    <pass-through-router>
    <stdio:outbound-endpoint system="IN" />
    </pass-through-router>
    </outbound>
    </service>
    </model>

  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Mon, 28 Feb 2011 02:58:06 .
    On 02/28/2011 07:45 AM, Thilan Saba wrote:
    I am developing and application with mule3.
    I have couple of question with regards to file transport.
    1. Is there anyway to filter the files depending on the size.

    Configure a filter on the endpoint. It will be used when polling the
    directory.

    2. mule-config details are given below. how can I get the input
    object as file. According to the following configuration. it passed
    org.mule.transport.file.ReceiverFileInputStream object instead of
    file object. Is it possible to get the file object from getPaylod
    method from MuleMessage object.

    Did you turn off streaming on the endpoint? IIRC it's enabled by default.

    -dirk
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • *Message imported, originaly posted: Mon, 28 Feb 2011 00:44:36 .
    I am developing an application with mule3. I have couple of question with regards to file transport.

    1. Is there anyway to filter the files depending on the size ? I would like to pick the files which size are garter than particular size.

    2. mule-config details are given below. how can I get the input object as file. According to the following configuration. it passed org.mule.transport.file.ReceiverFileInputStream object instead of file object.
    Is it possible to get the file object from getPaylod method from MuleMessage object.

    <file:connector name="inboundFileConnector"
    pollingFrequency="5000" autoDelete="false"
    moveToPattern="#function:datestamp:yyyy-MM-dd_HH-mm-ss--#function:count-#header:originalFilename">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
    <file:expression-filename-parser />
    </file:connector>

    <model name="MyModel">
    <service name="FileService">
    <inbound>
    <file:inbound-endpoint connector-ref="inboundFileConnector"
    path="C:/temp/filewatcher/inbox" moveToDirectory="C:/temp/filewatcher/history">
    <file:filename-wildcard-filter pattern=".txt,.pdf" caseSensitive="false" />
    </file:inbound-endpoint>
    </inbound>

    <component class="org.TestFileTransport" />
    <outbound>
    <pass-through-router>
    <stdio:outbound-endpoint system="IN" />
    </pass-through-router>
    </outbound>
    </service>
    </model>

    Thanks in advance.

    Edited by: Thilan Saba on Feb 27, 2011 10:44 PM
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. happy, confident, thankful, excited indifferent, undecided, unconcerned kidding, amused, unsure, silly sad, anxious, confused, frustrated