IBM Support

Want to rename producer filename while routing to consumer inbox? Custom facts in Routing Templates help you

Technical Blog Post


Abstract

Want to rename producer filename while routing to consumer inbox? Custom facts in Routing Templates help you

Body

If you are using Sterling File Gateway to route files between users and ever wanted to rename file in consumer Inbox? So this article is for you.

I want to cover "Custom facts" in Routing Channel Template along with an example. Custom facts help you to rename files while routing from producer to consumer Inbox. Screen-print below shows where these custom facts can be configured.

image

 

You have to be familiar with Regular Expressions to use custom facts to the fullest extent.

 

Consider a requirement where producer sends the file <File>.<YYYYMMDD><number> and when file routed to consumer Inbox, it needs to be changed to <prefix>_<File>_<YYYYMMDD>-<number>. e.g., TestFile1_201812210010 needs to be changed to KK_TestFile1_20181221-0010

 

First split Producer Filename using a regular expression "(.+)[.](\d{8})(\d{3,})" and gather resulting groups as facts. later create a consumer filename using those facts. You don't have to do this manually. Just configure regular expression and facts in Producer File structure as shown below.

image

 

 

Please note these custom fact names must be prefixed with "my".

 

Consumer File Structure looks like this -

image

 

Here is the complete Routing Channel Template -

image

 

 

I setup a channel between producer "kkprod" and consumer "kkcons". producer uploaded a file.

Arrived File Events and Delivery Events look as below -

image

 

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SS3JSW","label":"IBM Sterling B2B Integrator"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

UID

ibm11120491