In one of my previous tutorials I taught you how to send and receive RV messages in TIBCO using reliable RV. In this tutorial, I will teach you step by step how you can Publish and Subscribe Certified RV messages in TIBCO.
If you are yet unclear about two types of RV message communication, you can refer to my post Fundamental of TIBCO RV: How TIBCO RV Works?
Step 1: Create Certified RV Transport
Add Rendezvous Transport from RV Palette by dragging it to the design panel. In the configuration of your RV transport, give values for RV Daemon, Network and Service.
Configuration of RV Transport that I made is shown in the screenshot below:
In the Advanced tab of our RV Transport, we choose Certified as RV type, give a CM name and also specify Ledger file for this certified transport.
Complete configuration of Advanced tab of RV transport will look like below:
Step 2: Create a process to Publish Certified RV Messages
After successfully configuring Certified type RV transport, now we move towards Certified RV message publishing in TIBCO. Create a new process CertifiedPublish and inside process, use Publish Rendezvous Message activity (available in Rendezvous Palette).
In the configuration tab of Publish RV Message activity, we choose RV transport (Certified RV transport that we created in Step 1). We also specify some subject at which we will publish our RV message.
Configuration of Publish Rendezvous Message activity will look like below:
In this example tutorial of TIBCO Certified RV messaging, we will publish a simple message string from our Publish Rendezvous Message activity. So we need to create a String element in Input Editor tab as shown below:
In the Input tab, we will use XPath formula to concatenate current date and time with the hardcoded string “Sent from Certifed Publisher at:”
Input tab of our RV Publisher activity will look like below:
Now we are done with our Certified RV Publishing process. Validate the process and move on to creating a process for Subscribing to certified RV message.
Step 3: Create a process to Subscribe to Certified RV Messages:
Create a new TIBCO BW process CertifiedSubscriber (you can name it any). In this process, we will add Rendezvous Subscriber activity to receive RV messages on certified RV transport.
In the Configuration tab of RV Subscriber activity, use same transport and subject as used in the RV Publisher.
Configuration of RV Subscriber activity will be as shown in below screenshot:
In the Output Editor tab of this RV Subscriber activity we need to create a String element in the same way as created for our Publish Rendezvous Message activity in Step 2.
This is shown in screenshot below:
As our subscriber process has been started by receiving a RVCM message, we need to use Confirm activity to acknowledge the publisher upon receipt of message.
In confirm activity configuration, we choose RV subscriber as confirm event as shown below:
In order to see the results properly, I have added a Write File activity to write the RVCM message to a file in local file system.
Input mapping of Write File activity is shown in below screenshot:
This completes development part of our both publishing and subscribing processes.
Now we can move towards testing phase.
Step 4: Test Certified RV Messaging in TIBCO Designer
Validate the project and after successful validation, load both processes in designer tester. After loading the processes in tester, create a new job for publisher process CertifiedPublish. As you can see in screenshot below, both processes have executed completely:
Now we need to go into the individual processes in tester to verify that everything has worked fine. If we see Input Data tab of RV Publishing activity in CertifiedPublish process in tester, we can see that it has published a message on the given subject through Certified transport as shown below:
By going into the process CertifiedSubscriber in the tester, we can see in the Output tab of RV Subscriber activity that published message has been successfully received by this activity:
Now we need to go and look into the created file and see if subscribed message has been written in the file or not.
Wow great! As shown in below screenshot, message is written rightly in the file:
Now it is the time to test for a scenario specific to Certified RV messaging. What we are going to do now is that we will load and run only Publisher process and won’t load subscriber. In this way, message will get published but will not get an acknowledgement from the subscriber and will remain there in the Ledger file.
As you can see in screenshot below, Publisher process has run successfully without loading subscriber process:
Ledger file is created in the path which was specified in the RV transport configuration Advanced tab as you can see below:
Now, let’s reload both publisher and subscriber processes in designer tester and run a job for publishing process:
Ok I tell you the reason. When we ran a test by loading only Publishing process, the message which was published didn’t get an acknowledgement and was stored in ledger. Now when we ran both processes, subscriber has received that queued message as well and acknowledged both.
Now if you look into the file where our process writes the subscribed message, you can see that it has 3 messages in total with their timestamp information showing when they were published: