UDP 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. Both the sender and receiver adapters are configured on the default port numbers; the feed simulation will work as long as the Receiver port number isn't altered.

Running This Sample in StreamBase Studio

  1. In the Package Explorer, double-click to open the udp_uni_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_uni.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 'ReceiverControl' 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 'UDPReceiver'.

    Now you should no more tuples appearing on the Application Output tab.

    To reconnect, select 'ReceiverControl' 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_uni_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_uni.dat

  6. The processed tuples from inputstream_uni.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 permission problems. The default workspace location for this sample is:

studio-workspace/sample_adapter_embedded_udp_unicast

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_unicast

See Default Installation Directories for the default location of studio-workspace on your system.