+ All Categories
Home > Documents > Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back...

Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back...

Date post: 30-Jul-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
7
27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm service. We’ll look at the definitions through both the realm service web interface and the realm service web API. In order to get the most from this lesson, make sure you have read the TIBCO FTL R Concepts guide before proceeding. Note Throughout the remaining lessons, it is assumed that the FTL server and sample programs are running on the same computer. This allows the FTL server to be addressed via localhost:8080. If you want to run the FTL server on a different computer, a few changes must be made. Start the FTL server (on the desired computer) using the start_ftl script in $TIBFTL_TUTDIR/scripts, and specify the actual address and port. For example, if the computer on which the FTL server is to run has the address 192.168.10.1, and port 9000 is to be used, the command would be: ./start_ftl 192.168.10.1:9000 Likewise, when stopping the FTL server using the stop_ftl script, use: ./stop_ftl 192.168.10.1:9000 When accessing the realm service web interface, rather than navigating to http://localhost:8080, use (assuming the values above) http://192.168.10.1:9000. Change the URL in any curl command lines to reference the correct address and port. Add the -r ip:port option to any sample program command lines. Substitute the correct address and port for ip:port. 6.1 The Realm Service Web Interface Assuming the FTL server is still running, open a web browser and navigate to the URL http://localhost:8080. The resulting screen is shown in Figure 6.1. TIBCO FTL R Programming Tutorial
Transcript
Page 1: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

27

Lesson 6: Exploring the Realm

In this lesson we take a step back from FTL API programming and explore the realm definitions madeavailable by the realm service. We’ll look at the definitions through both the realm service web interfaceand the realm service web API.

In order to get the most from this lesson, make sure you have read the TIBCO FTLR�

Concepts guide beforeproceeding.

Note

Throughout the remaining lessons, it is assumed that the FTL server and sample programs arerunning on the same computer. This allows the FTL server to be addressed vialocalhost:8080.

If you want to run the FTL server on a different computer, a few changes must be made.

• Start the FTL server (on the desired computer) using the start_ftl script in$TIBFTL_TUTDIR/scripts, and specify the actual address and port. For example, ifthe computer on which the FTL server is to run has the address 192.168.10.1, and port9000 is to be used, the command would be:

./start_ftl 192.168.10.1:9000

Likewise, when stopping the FTL server using the stop_ftl script, use:

./stop_ftl 192.168.10.1:9000

• When accessing the realm service web interface, rather than navigating tohttp://localhost:8080, use (assuming the values above)http://192.168.10.1:9000.

• Change the URL in any curl command lines to reference the correct address and port.

• Add the -r ip:port option to any sample program command lines. Substitute thecorrect address and port for ip:port.

6.1 The Realm Service Web Interface

Assuming the FTL server is still running, open a web browser and navigate to the URLhttp://localhost:8080. The resulting screen is shown in Figure 6.1.

TIBCO FTL R� Programming Tutorial

Page 2: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

28

Figure 6.1: Realm service login page

Full documentation on the realm service web interface can be found in the TIBCO FTLR�

Administration

guide.

The first page shown is the login page. Normally you would enter the user ID and password assigned byyour administrator. For the sake of simplicity, in this tutorial we are running the FTL server withoutsecurity, in insecure mode. Insecure mode allows only a single user ID, “anyone”, with no password.

Click the “SIGN IN” button to display the next page:

TIBCO FTL R� Programming Tutorial

Page 3: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

29

Figure 6.2: Applications grid

Figure 6.2 shows the Applications grid, which displays all applications defined in the FTL system. Foreach application, the endpoints associated with it are shown, along with the transports associated with eachendpoint.

Along the left side of the page appear a series of links, each with an icon and description, which navigate tospecific pages in the realm service web interface. For example, the link denoted by the icon, andlabeled “Applications”, takes you to the Applications grid.

What is shown in Figure 6.2 is the initial, default configuration provided when starting a new FTL server.A single application is defined, “default”, along with its corresponding endpoints and transports.

The samples we’ve developed in previous lessons have implicitly used the “default” application. If youlook back at ftlbasicpub.c from lesson 5 ($TIBFTL_TUTDIR/code/lesson-05/ftlbasicpub.c),you see the line:

24 realm = tibRealm_Connect(ex, "http://localhost:8080", NULL, props);

The third argument to tibRealm_Connect() is a character string containing the application name. Byspecifying NULL, we are telling FTL to use the default application, which is conveniently named “default”— and is exactly the “default” application shown in Figure 6.2.

So, let’s take a look at the “default” application in more detail by clicking on the “default” applicationname. You should see a screen similar to Figure 6.3.

TIBCO FTL R� Programming Tutorial

Page 4: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

30

Figure 6.3: “default” Application details panel

This panel shows the detailed application information, including the application name (“default”) andapplication description. We can ignore the “Manage All Formats”, “Preload Formats”, and “InstanceMatching Order” items for now.

In the upper-right corner of the application display, a (close) control is shown. Clicking on this controlcloses the currently shown details panel, and is a common interaction used throughout the realm serviceweb interface. Close the Application details panel by clicking on the close control, which will take youback to the Applications grid:

TIBCO FTL R� Programming Tutorial

Page 5: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

31

Figure 6.4: Applications grid

The “default” application defines a single endpoint named “default”. The samples we’ve developed thus farhave implicitly used not only the “default” application, but also the “default” endpoint.

In $TIBFTL_TUTDIR/code/lesson-05/ftlbasicpub.c we had the line:

27 pub = tibPublisher_Create(ex, realm, NULL, NULL);

The third argument to tibPublisher_Create() is a string containing the endpoint name (within thatapplication) on which to publish. By specifying NULL, we are telling FTL to use the default endpointwithin the application, named “default”.

Similarly, in $TIBFTL_TUTDIR/code/lesson-05/ftlbasicsub.c we had the line:

1 sub = tibSubscriber_Create(ex, realm, NULL, cm, NULL);

The third argument to tibSubscriber_Create() is a string containing the endpoint name (within thatapplication) to subscribe to. By specifying NULL, we are telling FTL to use the default endpoint within theapplication, named “default”.

So let’s take a deeper look at the “default” endpoint. Click the “default” endpoint, which will open theEndpoint details panel:

TIBCO FTL R� Programming Tutorial

Page 6: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

32

Figure 6.5: “default” Endpoint details panel

Publishers and subscribers using the “default” endpoint of the “default” application communicate via astore. The store does not persist messages (note the “Store” name: “ftl.nonpersistent.store”) but insteadforwards published messages to all subscribers. This is called server-based messaging, and essentiallyemploys a message broker. Server-based messaging is simpler to manage and administrate thanpeer-to-peer messaging, which is why it is the default. A comparison of server-based and peer-to-peermessaging, as well as the benefits of each, will be presented in a later lesson.

It is important to note that the default application and endpoint really are named “default”. This is not areserved, hidden, or otherwise special name, but is the object reference used by the FTL server when noexplicit application or endpoint is specified. These “default” configuration settings are available whenstarting from an empty realm configuration and will remain part of the realm configuration unless they areexplicitly deleted.

6.2 The Realm Service Web API

The realm service web API can also be used to view, add, and modify definitions for FTL objects. For oursamples, we’ll use the open-source curl utility to access the realm service web API.

Consult the TIBCO FTLR�

Administration guide for details on the realm service web API.

JSON is used to represent FTL configuration information, both as input to add and modify objects, and asoutput to return the results of a realm service web API operation.

Assuming the FTL server is still running, open a command window and type:

curl -X GET http://localhost:8080/api/v1/realm/applications/default

The resulting output is shown in Listing 6.1.

TIBCO FTL R� Programming Tutorial

Page 7: Lesson 6: Exploring the Realm27 Lesson 6: Exploring the Realm In this lesson we take a step back from FTL API programming and explore the realm definitions made available by the realm

33

1 {2 "last_modified": "XXXX-XX-XXTXX:XX:XX.XXXXXXXXX-XX:XX",3 "last_modified_millis": XXXXXXXXXXXXX,4 "last_modified_by": "ftl",5 "name": "default",6 "id": XXX,7 "description": "",8 "manage_all_formats": false,9 "preload_format_names": [],

10 "endpoints": [11 {12 "name": "default",13 "id": XXX,14 "store": "ftl.nonpersistent.store",15 "cluster": "ftl.default.cluster",16 "description": "",17 "transports": [],18 "dynamic_durable": {19 "template": "ftl.pubsub.template"20 },21 "subscribers": []22 }23 ],24 "instances": []25 }

Listing 6.1: “default” application realm service web API output

This corresponds to the application definition from Figure 6.3, and you should be able to correlate itemsvisible via the realm service web interface with items in the JSON output.

A few things to note:

• Line 5 defines the name of the application, "default".

• Lines 10 through 23 list the endpoints. The value of the "endpoints" key is an array of objects. Inthis case the array contains a single endpoint object, “default”.

• Lines 11 through 22 define the “default” endpoint.

– Line 12 is the endpoint name, "default".

– Line 14 is the store used, "ftl.nonpersistent.store".

– Line 17 lists the transports associated with the endpoint. Since an endpoint can have more thanone transport, the value of the "transports" key is an array of objects. Since a store is used,no transport is present.

The JSON output also contains other information which we will discuss in later lessons.

TIBCO FTL R� Programming Tutorial


Recommended