TIBCO File Adapter is used to enable flow of information between files and TIBCO Enterprise Service Bus. File Adapters provide publication and subscription services which are used to get the data from the file or to write the data to the file respectively.
In this step by step tutorial on File Adapters, you will learn how you can use TIBCO File Adapter publication service to receive data from the text file and use it in the TIBCO designer process.
Step 1: Add File Adapter Configuration in the project
First we need to add File Adapter configuration in the project. Go to File Adapter Palette and drop the File Adapter Configuration in your project as shown in below screenshot:
We don’t need to make any configuration changes for File Adapter Configuration.
Step 2: Add Publication Service in File Adapter and Configure it
Double Click on the File Adapter configuration that you added in Step 1. Go to Adapter Services folder and add a new publication service from the File Adapter Palette.
In the configuration tab of Publication service, we are choosing Rendezvous as transport. As we want adapter service to get triggered for every new record in the file, we choose Record Transfer in the Transfer mode. In the Life Cycle, choose repeating as we don’t want the adapter to get triggered only once.
I have chosen Polling Interval to 30 seconds in this example scenario. Choose Input Directory by using browse option. This input directory will contain the file for which we are configuring publication service.
As we want to use File Adapter service for a specific file only, in Recognition Method choose By File Name.
File Name field will contain the name of the file that we want to use as input for adapter service.
Configuration tab of the File Adapter Publication Service will look like below screenshot:
In the Processing tab, browse and specify the Working Directory. In the Post Processing option, choose Leave as is as we don’t want to move the file to any other directory after processing.
Below screenshot shows how I have configured Processing tab:
Now moving on to the next tab—Schema, we need to first create a schema and only then we can add that schema to this tab.
We need to have a Read Schema in our adapter’s File Schemas folder. Go to File Schemas folder and add a new Read Schema.
Double Click on this Read Schema and then add a new Delimited File Record by following the way as shown in the below screenshot:
I have named this record as Student. In the Configuration of this File Record, choose a delimiter. I am going to use comma (,) as a delimiter in this example. In the Identifier Type, choose Field Value.
In the Attributes, we add record attributes by clicking on Add button. In this example, I have given the following attributes which will be used when adding content to the file:
Now that we have created the Read Schema and configured its record, we can move back to the Schema tab of our File Adapter Publication service.
In the Schema tab, add the Student Schema. It will now look like below:
In the Transport tab, we will have to specify the RV Subject, Quality of Service and Wire Format as shown below:
With this, we are done with the configuration and setup of our File Adapter Publication Service.
Step 3: Create a TIBCO Process with Adapter Subscriber to Receive data from File Adapter Publication Service
In this step, we will create a TIBCO Designer Process that will be able to receive the data from the file adapter publication service and will make the data available to the process. In real scenarios, data needs to be used in some way in the process after receiving it through Adapter Subscriber but in this example case, we will just receive the data and end the process.
Create a new process and add Adapter Subscriber Activity. As this activity is a process starter, it will replace the default Start activity from the process.
In the Configuration tab of the Adapter Subscriber, choose the File Adapter Publication Service that we created in previous step. This is shown in the diagram below:
In the Transport tab, we need to ensure that all our transport configurations including the Subject are matching with the Transport configuration of our Adapter Publication Service (which was configured in Step 2).
In below screenshot you can see the Transport parameters that I have used for Adapter Subscriber activity in this example:
We don’t need to make any further changes in the process. We are now ready to process with the testing step.
Step 4: Test File Adapter Publication Service
For testing the adapter based applications like this, we need to run two testers. First we need to run Adapter Tester and then designer tester.
Go to tools and click on Show Adapter Tester. A new window will open in which you have to select the file adapter and also specify a working directory as shown below:
Now click on the Start button which will start the adapter service. Now load the process that you created in previous step in the Designer Tester.
Once our adapter service and our process are ready in their respective testers, we can move forward and try adding a new record in the file.
Go to the file in the Input direcotory (in our example case the file is information.txt).
Add the following new record in the file and save:
student,ajmal,44
As you can see in the below screenshot, information has been pulled in by the adapter service and has been received by the Adapter Subscriber in the process:
Hi Ajmal,
Its a very good tutorial for beginners
But i have been trying to convert a file from positonal to csv using file adapter.
I have tried the same using data formats(without any file adapter) and it seems to work fine.
But in file adapter i seem to be stuck and I believe we need to use a publish and a subscribe service for that and i would be glad if you could provide some hints to accomplish the task
Other Details :
Using record transfer mode not SFT mode
Messaging : Rv
I am also getting same error. Can anyone please help.
Hi ajmal,
I have been working on transforming a file from 1 format to another and have accomplished the conversion of a positional file to csv file using data formats.
But im trying to do the same using a file adapter and i am stuck in the process….
The reason being my exposure to tibco and my knowledge about the tool.
Components and the procedure followed :
2 file adapters 1 for read a positonal file and publish it and 1 to subscribe from the process and write to a csv file.
I am confused about the choice of activities that i can use in the process.
Please guide me through it.
Hi Ajmal,
Thnak you for your useful post i followd and working fine but sitll i have a doubt.
1. wether it will publish whenever new recored addred (or) modification event occur in the file?
2. i specified 30 seconds as polling interval every 30 seconds it publishing same data if i added new data it has publishing both data?
kindly slove my doubt.
Thanks
Chinnakanna
Hi Ajmal Sir ,
I have received below error while run adopter tester
“Failed to load shared Library ,Library Name :addfiles50.dll”
Please let me know what steps i should follow to overcome this Problem.
Please share step by step approach with path details .
Thanks
Milan
Hi,
Ajmal Abbasi,
I m a starter of tibco deginer as a developer,
i have implemented sucessfully publish by value in adapter.
but next
i wanna know about how to implement publish by value .
pls update
Thanks and regrds
Rahul kumar ranjan
Hi Ajmal,
In the read schema, I am mentioning Identifier type as Number of fields.
what should be the format of input file.
I am giving input as
student,ajmal,44
I am getting error as..
‘Lines do not match the schemas:’
please help
i can not able to create file adopeter configuartion , because those option are not available
Hi Ajmal,
You have been doing the great job for long. Could you please find time to post a tibco file adapter subscription service example, so that it would be helpful for me as well as for many to learn the configuration concepts of it.
Regards,
Dinesh Kumar D.
Hi ,
We have a delimited file , which is being processed using the FileAdapter.
In the file we also have Header which has only the names of the fields .We would want to ignore this header being published by the PublicationService to the Subscriber.
Is there a way we can achieve this using the File Adapter ?
Thanks for the above tutorial. could you please make tutorial on Tibco SAP adapter as well.