In this step by step TIBCO Tutorial, I will read data from a text file (inputData.txt). The data in the text file will be a pipe (|) separated and It will have Name, Email, and Phone.
Once data is read from the queue, we need to send each row as separate messages to the queue.
Step 1: Create JMS Connection
As we are going to send the data to the EMS queue, we need to create a Connection to the EMS server. JMS Connection activity and configure it as shown in below screenshot. I am using the EMS as localhost. Using Test Connection make sure the configuration is correct and able to connect to the EMS server.
Step 2: Data Format
We need this Data Format pallet to parse the data details from the input file. This shared configuration resource specifies the type of formatting for the text (delimited columns or fixed-width columns), the column separator for delimited columns, the line separator, and the fill character and field offsets for fixed-width columns. You must also specify the data schema to use for parsing or rendering the text. Add this pallet to your project and configure it in as shown below.
Step 3: Create Schema for the JMS Queue Sender
We need this schema created to send the data to the queue in XML Format. I have created the below schema for this.
Step 4: Create Process to Read Text File, Parse Contents and Send to QUEUE
This is our final step in our goal. We need to add all the logic to this session. The complete process will look like below.
Let’s discuss each activity in detail.
Name|Email|Phone User1|user1@mail.com|123456778 User2|user2@mail.com|123456779 User2|user2@mail.com|123456779
I have configured this activity as shown below.
In the Configuration tab of JMS Queue Sender activity, we choose the Connection that was created in Step 1 and in the Input Editor tab, we need to choose the Schema which we created in Step 3 [Please note that the Input Editor tab will be active only if we select Message Type as XML Text in the configuration tab].
Note: The above code will work for the small files but if you try to process a large file with this code you may get OutOfMemory error depends on your system memory and heap size setting. Read How To Process Large files in TIBCO BW to know more.
That’s all folks. We have complete our project. Now you can run the test from the tester activity. Please make sure you selected Run Once while testing it if the Clock is not around 7 PM :).
Hope the tutorial helps. Let me know your suggestions if you have any.