cancel
Showing results for 
Search instead for 
Did you mean: 

JMS to File Scenario: How to retrieve the file name?

Former Member
0 Kudos

Hi All,

We have JMS to File scenario.

XML file with a specific file name is being put in the JMS queue. The JMS channel will poll the file from the queue.

We need to retrieve the file name in the mapping. The file name has an identifier concatenated and we required this identifier in the mapping.

Kindly let me know if there is a way to retrieve the file name.

Thanks,

Meenakshi

Accepted Solutions (0)

Answers (3)

Answers (3)

ambrish_mishra
Active Contributor
0 Kudos

Hi Meenakshi,

Please take a look at the following link at the end of the document.

http://help.sap.com/saphelp_nw73/helpdata/en/F4/2D6189F0E27A4894AD517961762DB7/frameset.htm

You need to ask the JMS provider to provide the file name as an additional attribute and then retrieve this in your mapping.

Hope it helps!

Ambrish

Former Member
0 Kudos

Hello,

I think, u can ask ur JMS provider to send the file name in JMS message header and then in ur JMS sender channel u can tick ASMA -> Specify additional JMS message property -> something like FileName (confirm attribute name from ur provider) and then in PI mapping u can use below udf:

try

{

DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "DCJMSMessageProperty0");

String filename = conf.get(key);

return filename;

}

catch (Exception e)

{

String exception = e.toString();

return exception;

}

Thanks

Amit Srivastava

gagandeep_batra
Active Contributor
0 Kudos

Hi Meenakshi,

I think you can retrieve the file name using dynamic config.

check the below code that may help:

---------------------------

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

//conf.removeAll();

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

//String filename= conf.get(key);

conf.put(key, fileName);

key= null;

return fileName;

---------------------------------------------

Regards

Gagan