Contents
This sample demonstrates the ability to both send and receive strings through the use of the TIBCO StreamBase® Adapters for UDP in multicast mode. Both the sender and receiver adapters are configured on the default Multicast Group IP and Port number. This sample contains 1 UDPSender and 2 UDPReceivers in order to illustrate the use of the multicast message delivery.
-
In the Package Explorer, double-click to open the
udp_multi_sample.sbapp
application. Make sure the application is the currently active tab in the EventFlow Editor. -
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
Click on the 'Feed Simulations' tab. Select 'input_stream_multi.sbfs' and click the button marked 'Run'.
You should now see tuples on the Application Output tab. There will be two copies of each tuple, one from each of the receiver output streams.
Next, try selecting the 'Receiver2Control' input stream from the drop-down menu in the Manual Input tab. Type 'disconnect' and hit 'Send Data'. This will close the connection to the multicast group for 'UDPReceiver2'.
Now you should only see 1 copy of each tuple on the Application Output tab.
To reconnect, select 'Receiver2Control' and send the command 'connect'.
-
When done, press F9 or click the Stop Running Application button.
-
Open four terminal windows on UNIX, or four StreamBase Command Prompts on Windows. In each window, navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above.
-
In window 1, run
sbd udp_multi_sample.sbapp
-
In window 2, run
sbc dequeue ReceiverOutput
-
In window 3, run
sbc dequeue ReceiverOutput2
-
In window 4, run
sbc enqueue SenderInput < inputstream_multi.dat
-
The processed tuples from inputstream_multi.dat should be written on both windows 2 and 3.
-
When done, run
sbadmin shutdown
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, click
→ . -
Select this sample from the Embedded Adapters list.
-
Click OK.
StreamBase Studio creates a single project containing the sample files.
When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.
Important
Load this sample in StreamBase Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.
Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:
studio-workspace
/sample_adapter_embedded_udp_multicast
See Default Installation Directories for the default location of studio-workspace
on your system.
In the default TIBCO StreamBase installation, this sample's files are initially installed in:
streambase-install-dir
/sample/adapter/embedded/udp_multicast
See Default Installation Directories for the default location of studio-workspace
on your system.