gotApplEvent()

Sends a business object to InterChange Server.

Syntax

int gotApplEvent(BusinessObject &busObj);
 

Parameters

busObj [in]
is the business object being sent to InterChange Server.

Return values

An integer that indicates the outcome status of the event delivery. Compare this integer value with the following outcome-status constants to determine the status:

BON_SUCCESS
The connector framework successfully delivered the business object to the connector framework.

BON_FAIL
The event delivery failed.

BON_CONNECTOR_NOT_ACTIVE
The connector is paused and therefore unable to receive events.

BON_NO_SUBSCRIPTION_FOUND
No subscriptions exist for the event that the business object represents.

Notes

The gotApplEvent() method sends the busObj business object to the connector framework. The connector framework does some processing on the event object to serialize the data and ensure that it is persisted properly. It then makes sure the event is either sent to the ICS through IIOP or written to a queue (if you are using queues for event notification).

Before sending the business object to the connector framework, gotApplEvent() checks for the following conditions and returns the associated outcome status if these conditions are not met:
Condition Outcome status
Is the status of the connector active; that is, it is not in a "paused" state? When the connector's application-specific component is paused, it no longer polls the application. BON_CONNECTOR_NOT_ACTIVE
Is there any subscription for the event? BON_NO_SUBSCRIPTION_FOUND

Note:
Because gotApplEvent() makes sure that the business object and verb to be sent have a valid subscription, you do not need to call isSubscribed() immediately before calling gotApplEvent().
WebSphere InterChange Server

Usually, you call the gotApplEvent() method from the pollForEvents() thread. InterChange Server uses the pollForEvents() method to request the connector to send subscribed events to it. The connector uses the gotApplEvent() method to send business objects to the connector framework, which in turn routes them to InterChange Server in response.

The poll method should check the return code from gotApplEvent() to ensure that any errors that are returned are handled appropriately. For example, until the event delivery is successful, the poll method should not remove the event from the event table.

Examples

SubscriptionHandlerCPP * theSubHandler = 
       GenGlobals::getTheSubHandler(); 
  
 // Determine whether there are subscribers to the event
 if (theSubHandler->isSubscribed(obj_name, obj_verb) != TRUE) {
    // log message
    // delete event from event table
    // add event to archive table
    continue;
 }
  
 // Prepare to retrieve data into the business object
 pObj = new BusinessObject(obj_name);
 pObj->setVerb("Retrieve");
  
 // Set key in business object
  
 // Call the business object handler doVerbFor() 
 // to retrieve data
 if (pObj->doVerbFor() == BON_FAIL) {
    // Log error message if retrieve fails
    retcode = BON_FAIL;
    break;
 }
  
 // Call gotApplEvent() to send the business object
 pObj->setVerb(obj_verb);
 theSubHandler->gotApplEvent(*pObj);
 if ((theSubHandler->gotApplEvent(*pBusObj)) == BON_FAIL) {
    // Log error message
    retcode = BON_FAIL;
    break;
 }
 

See also

See also the description of the BusinessObject Class and the pollForEvents() method.

Copyright IBM Corp. 1997, 2003