Search code examples
javaibm-integration-bus

Setting an output filename using IIB


I have an integration that read messages from IBM mQ, thus no filename is created in message environment. I need to assign filename (f.e. ETOS_Message_timestamp.mxl) but not exactly sure how to.

I can access the Message Assembly in java.

guess not much code to show needed

Thanks in advance


Solution

  • You can assign the file name in the local environment tree using either esql OR java

    Below is a sample of ESQL:

      SET OutputLocalEnvironment.Destination.File.Directory = '/tmp/FileDirectory'; 
      SET OutputLocalEnvironment.Destination.File.Name = '<<Your file name>>'
    

    Below is a sample of Java code:

      MbMessage OutputLocalEnviron = new MbMessage(objmsg.getLocalEnvironment()); 
      MbElement outLocEnv = OutputLocalEnviron.getRootElement();
      outLocEnv.evaluateXPath("?Destination[1]/?File[1]/?Directory[1][set-value('Your file name')]");