Question
Pegasystems Inc.
JP
Last activity: 2 Nov 2016 5:40 EDT
7.1.9 How to specify relative directory path as file listener's "source location"
I wanted to specify a relative directory path as file listener's "source location".
I tried below without success. Am I missing something or simply file listener doesn't support this syntax?
It seems that "file://default:/" was not translated to actual path name.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Virtusa
IN
Hi Chunshi,
Could you please share us the location where the csv file is located.
If this is in the local system, Please use the exact location of the file where it is located.
Thanks.
Pegasystems Inc.
JP
The location of the CSV file will differ from instance to instance, we don't want to put an absolute path name as a "source location".
The fully qualified path name will consist of two part, {instance specific root directory for uploaded csv files}, and {application defined directory where a file listener will listen to}.
It seems that PRPC rule engine is using the sytax "file://web:/" or "file://default:/" to determine the actual location of directories, so I am exploring the possibilities if we can use the same syntax in the file listener definition.
Pegasystems Inc.
AU
Hey Chunzhi,
The help for File Listeners suggest you could use the declare_CachedDataSystemSetting pattern to fill this; on your LoadApplicationDataSystemSettings activity you could refer to pxRequestor,pxReqContextURI or something of the like to construct this setting.
Identify a directory in which the listener looks for input files. Listener requests require read and write access to this directory.
This field supports the Global Resource Settings syntax (=.PageName.PropertyName). The default property name for this field is pySourceLocation. For more information,see Using the Global Resource Settings feature.
Pegasystems Inc.
JP
Hi Joel,
Thanks for your reply.
How can I get the actual value of "file://default:" in an activity?
Are there any engine API that can access those prconfig settings?
Since we are not allowed to modify any rules in the prod instance, we must be able to access one of those pre-defined instance level settings in prconfig or some where.
Chunzhi
Pegasystems Inc.
GB
Hi Chunzhi,
You should be using Global Resources for this scenario, this is a common problem for such rules where for ex a url or a path can be different for different environments.
this can be done for File Listeners too. the help for File Listener also mentions the same.
have a look at following PDN article and help I hope this helps,
https://community.pega.com/sites/default/files/help_v719/procomhelpmain.htm
Thanks
Manu
Pegasystems Inc.
JP
Hi Manu,
I just tried using global resource syntax: PageName.propertyName, but it didn't work.
Am I missing anything here?
Source location
Value of pxProcess.pxWebRootPath
Error log: (It seems that global resource syntax was treated as literal string)
2016-02-02 12:32:29,940 [ FILE-Thread-35] [ STANDARD] [ ] [ ] ( services.file.FileListener) ERROR File.MyFileListener hongcz - Unexpected exception caught during processing.
java.lang.Exception: [C:\pega\pe719\PRPCPersonalEdition\scripts\pxProcess.pxWebRootPath] does not exist.
Hi Manu,
I just tried using global resource syntax: PageName.propertyName, but it didn't work.
Am I missing anything here?
Source location
Value of pxProcess.pxWebRootPath
Error log: (It seems that global resource syntax was treated as literal string)
2016-02-02 12:32:29,940 [ FILE-Thread-35] [ STANDARD] [ ] [ ] ( services.file.FileListener) ERROR File.MyFileListener hongcz - Unexpected exception caught during processing.
java.lang.Exception: [C:\pega\pe719\PRPCPersonalEdition\scripts\pxProcess.pxWebRootPath] does not exist.
at com.pega.pegarules.integration.engine.internal.services.file.FileListener.initialize(FileListener.java:1803)
at com.pega.pegarules.integration.engine.internal.services.file.FileListener.run_(FileListener.java:1878)
at com.pega.pegarules.integration.engine.internal.services.listener.ServiceListenerBaseImpl.run(ServiceListenerBaseImpl.java:453)
at java.lang.Thread.run(Unknown Source)
Pegasystems Inc.
CA
GRS syntax must begin with "=".
You could try this: =pxProcess.pxWebRootPath.
Pegasystems Inc.
JP
After adding "=" before the PageName, it seems that the pxProcess.pxWebRootPath was replaced by its value, however listener still failed to start up, because "file://web:/" wasn't interpreted correctly.
2016-02-02 14:13:42,556 [ FILE-Thread-36] [ STANDARD] [ ] [ ] ( services.file.FileListener) ERROR File.MyFileListener hongcz - Unexpected exception caught during processing.
java.lang.Exception: [C:\pega\pe719\PRPCPersonalEdition\scripts\file:\web:\StaticContent\global] does not exist.
at com.pega.pegarules.integration.engine.internal.services.file.FileListener.initialize(FileListener.java:1803)
at com.pega.pegarules.integration.engine.internal.services.file.FileListener.run_(FileListener.java:1878)
at com.pega.pegarules.integration.engine.internal.services.listener.ServiceListenerBaseImpl.run(ServiceListenerBaseImpl.java:453)
at java.lang.Thread.run(Unknown Source)
UnitedHealth Group
IN
Pegasystems Inc.
JP
Hi Prasad,
Thanks for your post!
>We have given absolute path of file folder to be referred as the value of pySourceLocation - ( /folder1/folder2/FileFolder)
I agree that absolute path will work.
However, what I want to achieve is using one of a few predefined system settings to specify root path of the file listener's source location.
The client wanted to have the control over the root path and they are not allowing us to modify any rules on prod instance.
If you look into SMA > Administration > Configuration Management, there is a couple of system settings using syntax like "file://web:" to specify a directory path
for example, "initialization/pxserviceexportpath = file://web:/StaticContent/global/ServiceExport/" and that is the reason why I am explorering the possibility of using relative path with file listeners.
Chunzhi
Pegasystems Inc.
CA
At this point, file listeners do not support relative paths for source location.
Pegasystems Inc.
CA
Looking at the code, it must be a simple change to get this working. But in my opinion, this would only make sense if the file listener is running on a particular node and you give a relative path applicable to that node, isn't it? If the listener runs on more than one node, the path you give here must be accessible to all nodes. That's why typically one gives absolute path of a shared location as the source location so that this location is accessible to all nodes.
Pegasystems Inc.
JP
Hi Praneeth,
Thanks for your post!
In a mutil-node environment, I think it is more common to use exactly same path on each node to access shared network file system and the absolute physical path of the network file system is hidden behind mounting point.
But I am not sure if we really need to run the file listener on multiple nodes, I think it is going to be more difficult trouble shoot some issues casued by concurrent processing.
Chunzhi
Pegasystems Inc.
CA
Then you may have to raise an enhancement request to support relative paths in a single-node configuration.
Areteans
AU
Hi,
Even i am getting same error.
My file location is "file://web:/StaticContent/global/ServiceExport/".
Please suggest me how to resolve this issue.
Thanks,
Divya Sri Padarthy