Question

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?

file-listener-source-location.png

It seems that "file://default:/" was not translated to actual path name.

file-listener-connect-fail.png

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

January 28, 2016 - 6:29am

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.

January 28, 2016 - 7:48pm
Response to ARULDEVANT

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.

January 28, 2016 - 7:56pm
Response to Chunzhi_Hong

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.

January 28, 2016 - 8:11pm
Response to JoelMcLeish

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

Pega
January 29, 2016 - 9:16am
Response to Chunzhi_Hong

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://pdn.pega.com/how-reduce-maintenance-service-rules-and-listeners-global-resource-settings

https://pdn.pega.com/sites/pdn.pega.com/files/help_v719/procomhelpmain.htm#concepts/concepts2/usingglobalresourcesetting…

Thanks

Manu

February 1, 2016 - 10:46pm
Response to ManuV_GCS

Hi Manu,

I just tried using global resource syntax: PageName.propertyName, but it didn't work.

Am I missing anything here?

Source location

file-listener-source-location-refer-datapage.png

Value of pxProcess.pxWebRootPath

file-listener-source-location-refer-datapage-value.png

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)

February 1, 2016 - 11:54pm
Response to Chunzhi_Hong

GRS syntax must begin with "=".

You could try this: =pxProcess.pxWebRootPath.

February 2, 2016 - 12:19am
Response to PraneethPurighalla

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)

February 2, 2016 - 2:29am

We have used Declare/Data page at node level with the following syntax in File Listener and it is working absolutely fine for us. We have given absolute path of file folder to be referred as the value of pySourceLocation - ( /folder1/folder2/FileFolder)

PEGA Version : 7.1.8

February 2, 2016 - 3:02am
Response to Prasad_BY

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

February 2, 2016 - 4:15am
Response to Chunzhi_Hong

At this point, file listeners do not support relative paths for source location.

February 2, 2016 - 4:50am
Response to PraneethPurighalla

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.

February 2, 2016 - 7:26am
Response to PraneethPurighalla

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

February 2, 2016 - 7:33am
Response to Chunzhi_Hong

Then you may have to raise an enhancement request to support relative paths in a single-node configuration.

November 2, 2016 - 5:40am

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