Place User addressing

Now we know the format of an AMETAS message and have some idea how to create it. The message now needs some addressee, and this is a Place user. We will now describe the addressing scheme of AMETAS.

  Place user addressing has undergone some changes in AMETAS during the last releases. We will at first describe the currently recommended ways of handling the addressing in AMETAS. After that, the previous view on addressing is shown which is still valid but not recommended any more.

The Place user ID

In AMETAS, each Place User has a unique ID. This ID is an instance of the class AMETASPlaceUserID. The Place User ID is - primarily - a black box:

Figure 1: Place User ID

A black box does not reveal its contents. This is only partly true because the AMETAS API still allows you to check parts of the ID. You should, however, avoid the inspection of IDs. Future releases may change to a new scheme, breaking your applications. Thus, you should treat the ID as opaque.

A black box also does not give details on its construction. But we need such an ID for addressing, so there must be a way to get the address.

Figure 2: Creating a new Place User

You could already have it, as Figure 2 shows: When using requestPUStartup or spawnAgent, the Place User ID is returned by these methods. You as the creator get these addresses, and should use them for communication purposes. You might also propagate these IDs among your other Place Users.

Another way of getting a Place User ID is by listening to Place User events. Listening to Place User events requires special privileges.

If you don't have the ID ... then why should you try to contact the Place User? Quite easy: The Place User might serve for some special purpose, for example, a service for writing files. In this situation, you know what the requested Place User should do, and you should ask the system to find such a Place User for you.

Figure 3: Getting a Place User ID

Figure 3 shows the canonical way to get the ID. Basically, you need to have some description of the addressee. The mediator then tries to find those Place Users which have matching descriptions. You may then decide which Place User to address.