Component Communication Wizard

The Component Communication Wizard, used for both the COM component and the Script component, resembles the XML Communication Wizard; however, it is limited by the fact that you can only select an available method. Let's walk through this wizard:

1. At the Welcome page you are prompted whether the action will Initiate a synchronous method call or if it will Wait for a synchronous method call. The former means that the XLANG scheduler engine will make that method call on behalf of the schedule and then wait for the response. In the latter, it will wait for another application to make the call and relay the response to the action.When using the noninstan-tiated component, you make use of this way of interacting with the schedule. To prevent the schedule from waiting forever, you can enter a wait period. By default, this is zero, which means that you expect that the method call has already been made when you arrive at that point in the schedule. A period longer than 180 seconds will force the schedule to be dehydrated.

2. Click Next, and you will go to the Message Information page (Figure 7.32). Here you can choose to Create a new message for the method call, or Add a reference to an existing synchronous message pair. The latter is useful if you want to make a method call for which a message already exists, although you can make a new message pair for a call to the same method. If you choose Add a reference to an existing synchronous message pair, go to step 4.

Figure 7.32 Select to Create a New Message, or Use an Existing One for a Method Call

Figure 7.32 Select to Create a New Message, or Use an Existing One for a Method Call

Note that the Component Communication Wizard explicitly mentioned synchronous method calls.You may or may not know that there are also asynchronous method calls.Why you cannot use asynchronous method calls within XLANG scheduler will be addressed shortly, but first we will discuss what you need to know about synchronous calls.

The only thing important to remember is that a synchronous method call will only return when the component returns with a result or an error. This means that the processing of the XLANG schedule only continues after the method call returns. Asynchronous method calls directly return without waiting for the result. If you used asynchronous method calls in your code, it would continue executing, without the delay of waiting. Of course, this assumes that the code does not directly need the result to continue. Once the called component has finished and has something to return, be it a result or an error, it will make a "call-back."Therefore, the calling component has a callback function that is called to hand over the result. An example of the use of asynchronous functions is a main program requesting information, like status info, from different services on the same or on other systems. It needs this information for logging or processing information, but the processing will only start after the information is returned. Moreover, since you do not know how much time it takes for the component to return, you can "poll" one after the other component and process the information as is comes in. Technically, this will mean that after the asynchronous component calls the callback function; this function needs to save the returned information in a place—for example, in a object queue—that the main procedure can regularly check to see if a result has arrived, and if so, take it from the queue and process it.

So, why is it not possible to use asynchronous method calls in XLANG schedules? First, since the flow would not wait for the result, the schedule can end before the result is returned. Second, if the result is returned, it is not clear how the XLANG schedule has to handle it. Remember, the result is returned through a callback function, which works differently than a component that makes a synchronous call to a port, where the in- and out-result are bound together in one port. Asynchronous communication can be easily achieved through messaging, so there is no need to make complex provisions to be able to handle asynchronous method calls.

3. Click Next to arrive at the last page, Message Specification Information (Figure 7.33). Here, you can select one of the available methods. Below this field are two lists: IN Fields and OUT Fields.The

IN lists the_Sender_, which may hold the identity of the caller, and the method's parameters. The OUT lists the_Status_, which will hold the HRESULT, the parameters, and the method (function) result, if rele-vant.You are not able to modify the fields, and you need to populate the parameters on the Data page.

4. Click Finish and the connection is added. Notice that on the Data page, the IN and OUT messages are fused together and act as a single unit.

Figure 7.33 Select One of the Available Methods for the Component

Figure 7.33 Select One of the Available Methods for the Component

■XT lath.

M

-.TW1

[r r -rhri

Was this article helpful?

0 0

Post a comment