6 Replies Latest reply: May 29, 2012 12:59 PM by Keith Babo RSS

Tooling for File Gateway

Keith Babo Master

Kicking off a discussion for SWITCHYARD-817 .

 

Looking at this, we can break this down like so (in order)

 

  1. Implement support for file bindings for services (Camel consumer) and for references (Camel producer).  Initial support will be in-only with basic options.
  2. Implement advanced options.
  3. Add support for in-out where file binding is used for the in and out.

 

I say we take care of #1 as part of SWITCHYARD-817 (or maybe a sub-task) first and handle #2 and #3 as separate JIRAs later.


For reference, the file binding schema can be found here:

https://github.com/jboss-switchyard/components/blob/master/camel/camel-core/src/main/resources/org/switchyard/component/camel/config/model/v1/camel-v1.xsd#L56

 

This is the first binding where the config options will be different for services and references.  So we will need to have some intelligence in the binding wizard and property sheet that reflects this fact. 


Basic config options for service bindings (from GenericFileBindingType and FileConsumerType):

 

<element name="directory" type="string" />
<element name="autoCreate" type="boolean" minOccurs="0" maxOccurs="1"/>
<element name="fileName" type="string" minOccurs="0" maxOccurs="1"/>
<element name="delete" type="boolean" minOccurs="0" maxOccurs="1"/>
<element name="recursive" type="boolean" minOccurs="0" maxOccurs="1"/>
<element name="preMove" type="string" minOccurs="0" maxOccurs="1"/>
<element name="move" type="string" minOccurs="0" maxOccurs="1"/>
<element name="moveFailed" type="string" minOccurs="0" maxOccurs="1"/>
<element name="include" type="string" minOccurs="0" maxOccurs="1"/>
<element name="exclude" type="string" minOccurs="0" maxOccurs="1"/>
<element name="maxMessagesPerPoll" type="integer" minOccurs="0" maxOccurs="1"/>
<element name="delay" type="integer" minOccurs="0" maxOccurs="1"/>

 

 

Basic config options for reference bindings (from GenericFileBindingType and FileProviderType):

 

<element name="directory" type="string" />
<element name="autoCreate" type="boolean" minOccurs="0" maxOccurs="1"/>
<element name="fileName" type="string" minOccurs="0" maxOccurs="1"/>
<element name="fileExist" type="string" minOccurs="0" maxOccurs="1"/>
<element name="tempPrefix" type="string" minOccurs="0" maxOccurs="1"/>

 

 

I'll post some thoughts on #2 and #3 once we agree on #1. :-)

  • 1. Re: Tooling for File Gateway
    Keith Babo Master

    BTW, if you want to see a description of the various configuration parameters, you can find that here:

    http://camel.apache.org/file2.html

     

    Most (all?) of the config elements have the same name as the endpoint URI parameters in the above documentation, so a quick ^F will get you where you need to be.

  • 2. Re: Tooling for File Gateway
    Brian Fitzpatrick Apprentice

    Do we have any example SwitchYard configs with the consumer or producer options set?

  • 3. Re: Tooling for File Gateway
    Keith Babo Master

    I will put an example together.

  • 4. Re: Tooling for File Gateway
    Keith Babo Master

    Example of service and reference:

     

     

    <sca:service name="test" promote="abc123/test">
          <sca:interface.wsdl interface="Foo.wsdl"/>
          <camel:binding.file>
             <camel:directory>target/input</camel:directory>
             <camel:fileName>in.txt</camel:fileName>
             <camel:consume>
                <camel:initialDelay>50</camel:initialDelay>
                <camel:delete>true</camel:delete>
             </camel:consume>
         </camel:binding.file>
        </sca:service>
        <sca:reference name="bar" multiplicity="0..1" promote="abc123/bar">
          <sca:interface.wsdl interface="Bar.wsdl"/>
          <camel:binding.file>
             <camel:directory>target/output</camel:directory>
             <camel:fileName>out.txt</camel:fileName>
             <camel:produce>
                <camel:fileExist>Append</camel:fileExist>
                <camel:tempPrefix>work</camel:tempPrefix>
             </camel:produce>
         </camel:binding.file>
        </sca:reference>
    
    
  • 5. Re: Tooling for File Gateway
    Łukasz Dywicki Novice

    Camel file is really huge code base. For basic options autocreate, and other simple types there is not many philosophy. A bit more support we can push to preMove, move, moveFailed as they're expressions (in simple dialect) and can be evaluated. I implemented most of camel file properties but as Keith pointed, they can be limited to only these most important. To distinguish core options we can put some annotation to XSD.

  • 6. Re: Tooling for File Gateway
    Keith Babo Master

    FYI - Brian completed an initial version and it's available in the tooling nightlies if you're interested.