Menu

AS2DirectoryPollingModule sentdir date outputs just the pattern

Help
Scott
2019-04-02
2019-09-10
  • Scott

    Scott - 2019-04-02

    Hello,

    I am finding that for the sentdir attribute with AS2DirectoryPollingModule,
    when I use the date generator the folders are created with the pattern and
    delimiters as the name.

    From my config.xml:

    <module classname="org.openas2.processor.receiver.AS2DirectoryPollingModule"
        outboxdir="C:/FolderA/FolderB/Outbound"
    
    sentdir="$properties.storageBaseDir$/FolderA/FolderB/Outbound/AUDIT/$date.yyyy$/$date.MMdd$"
        errordir="C:/FolderA/FolderB/Outbound/ERROR"
        interval="5"
        defaults="sender.as2_id=company, receiver.as2_id=tradingPartner"
        sendFilename="true"
        mimetype="application/EDI-X12"/>
    

    The other date references in config.xml seem to be working fine and I have
    modified one successfully.
    For sentdir I have also tried using $properties.storageBaseDir$ instead of
    C: and also just have C:/$date.yyyy$ with no success.
    I am using Open AS2 Server 2.6.4.

    I feel there's an obvious oversight on my part...
    Thank you

     

    Last edit: Scott 2019-04-02
  • Christopher Broderick

    Currently you can only use dynamic variables that can be evaluated at startup of the application in the directory paths.
    I imagine you are pobably seeing the $properties.baseDir$ is correctly replaced but not the $date.yyyy$/$date.MMdd$"
    I can see the value in being able to have them evaluated in real time to better segregate your logs and will add that into the next release.
    The issue is logged here:
    https://github.com/OpenAS2/OpenAs2App/issues/153
    You can add yourself to the issue to be notified when it is updated.

     
  • Scott

    Scott - 2019-04-02

    Hi Christopher, thank you for the quick reply.
    Your observation is correct - $properties.storageBaseDir$ works fine in the paths.
    Thank you for considering the change.

    I know it's a slightly difference issue, but I wanted to also mention that I also have found unexpected behaviour for MessageFileModule with the below filename attribute set:
    filename="C:/folderA/folderB/Inbound/$msg.content-disposition.filename$-$msg.headers.message-id$"

    That line ends with the same dynamic variables as used by the example in the original config.xml.

    The $msg.content-disposition.filename$ just comes through in the filename as "noContentDispositionFilename" but the $msg.headers.message-id$" appears to work fine. Here's an example filename I got:
    noContentDispositionFilename-1554174718565.70622@nlACjtw8bWqZNPIb4g==

    Additionally, instead of the file ending up in C:/folderA/folderB/Inbound, the file ends up in some already existing sub-folders: C:/folderA/folderB/Inbound/AUDIT/2019/0402
    I am not sure how it happened to choose the latest available MMDD folder, but it did! Are you able to explain how I could avoid the file going into the sub-folders?

    Thank you,
    Scott

     
  • Christopher Broderick

    In terms of getting "noContentDispositionFilename" , this is a problem with the way your partner is sending AS2. The specification does not require that you send the filename as part of the AS2 message. The OpenAS2 setting to send the file name is in the DirectoryPollingModules "sendfilename" attribute and the name sent defaults to the name of the file picked up from the polling directory but can be modified as defined in the OpenAS2HowTo. You could try asking your partner to enable sending the file name.

    In terms of why it ends up in a sub folder I am guessing you already verified you do not have a 2nd definition overriding the first? If not it might be something to do with the "$msg.content-disposition.filename$" dynamic variable. I suggest you enable trace level logging to see if it will shed light on it. If not we can try to debug further by adding some additional debug if necessary.

     
    • jll

      jll - 2019-09-04

      Christopher, I understand that you have noContentDispositionFilename hardcoded as what will appear in the local filename prefix if the partner specifies no filename. I also understand that it's possible to remove this from our local file names by removing $msg.content-disposition.filename$ from entries in config.xml so that the local file names will not prefix with that.

      Would it be possible for you to include somewhere in the configuration an option to override what that default hardcode value is? I think I'd like to see what filename my partner is sending when they do, but if they're not sending one, I'd like to set that prefix to something very short or blank to keep my file name length down and more manageable.

      Could you consider this as an enhancement for an upcoming release?

      Thanks as always for your efforts on both the support and dev side.

       

      Last edit: jll 2019-09-04
      • Christopher Broderick

        See 2.9.3 release ....

         
        • jll

          jll - 2019-09-05

          Awesome. Thanks Christopher, that was super fast.

           

          Last edit: jll 2019-09-05
  • Scott

    Scott - 2019-04-03

    Hi Christopher,
    Thank you for the explanation.
    It seems the 2nd issue is most likely is to do with the "$msg.content-disposition.filename$" dynamic variable.
    Thank you,
    Scott

     
  • Christopher Broderick

    See 2.9.3 release ....

     
  • Chikna

    Chikna - 2019-09-09

    I downloaded 2.9.3 and added the following and it's working, but I have a question on Polling 1 and Polling 2 options below. I am using Polling 1, but what's the purpose of Polling 2 (not necessary I guess). Also, as2_receive_message_filename_fallback="$rand.shortUUID$" under properties, where do you use this?

    Polling 1 options:

    <module mimetype="application/EDI-X12" sentdir="$properties.storageBaseDir$/$mdn.msg.sender.as2_id$-$mdn.msg.receiver.as2_id/sent/$date.YYYY$/$date.MM$" interval="5" sendfilename="true" stored_error_filename="$msg.attributes.filename$-$date.YYYY$-$date.MM$-$msg.headers.message-id$" errordir="$properties.storageBaseDir$/toPartnerA/error/$date.YYYY$/$date.MM$" stored_sent_filename="$msg.attributes.filename$-$msg.headers.message-id$" classname="org.openas2.processor.receiver.AS2DirectoryPollingModule" defaults="sender.as2_id=MyCompany_OID, receiver.as2_id=PartnerA_OID" outboxdir="$properties.storageBaseDir$/toPartnerA/"></module>

    Polling 2 options:

    <module mimetype="application/EDI-X12" sendfilename="true" errordir="$properties.storageBaseDir$/toPartnerB/error" interval="5" classname="org.openas2.processor.receiver.AS2DirectoryPollingModule" defaults="sender.as2_id=MyCompany_OID, receiver.as2_id=PartnerB_OID" outboxdir="$properties.storageBaseDir$/toPartnerB"></module>

     
  • Christopher Broderick

    The directory polling entries are all examples. You should set your own as needed.

    Search for "as2_receive_message_filename_fallback" in the OpenAS2HowTo for the usage of the attribute.

     

Log in to post a comment.