UDP Multicast Mode Input and Output Adapter Sample

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.

Running This Sample in StreamBase Studio

  1. 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.

  2. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  3. 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'.

  4. When done, press F9 or click the Stop Running Application button.

Running This Sample in Terminal Windows

  1. 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.

  2. In window 1, run sbd udp_multi_sample.sbapp

  3. In window 2, run sbc dequeue ReceiverOutput

  4. In window 3, run sbc dequeue ReceiverOutput2

  5. In window 4, run sbc enqueue SenderInput < inputstream_multi.dat

  6. The processed tuples from inputstream_multi.dat should be written on both windows 2 and 3.

  7. When done, run sbadmin shutdown

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top menu, click FileLoad StreamBase Sample.

  • Select this sample from the Embedded Adapters list.

  • Click OK.

StreamBase Studio creates a single project containing the sample files.

Sample Location

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 the permission problems that can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:

studio-workspace/sample_adapter_embedded_udp_multicast

See Default Installation Directories for the 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.