15 Using Guaranteed Real-Time Events

This chapter contains the following topics:

15.1 Understanding Guaranteed Real-Time Events

A real-time event is a notification that a business transaction has occurred in JD Edwards EnterpriseOne. You can use a JD Edwards EnterpriseOne HTML client to generate a real-time event on the JD Edwards EnterpriseOne server. Real-time events can be used for both synchronous and asynchronous processing.

An example of synchronous processing is to use real-time events to update an auction site that uses JD Edwards EnterpriseOne as a back-end solution. A user enters a new item for auction, which triggers a transaction into the JD Edwards EnterpriseOne system. The system captures the transaction and sends a notification to an interoperability server that communicates the information to a web engine to update the HTML pages so that all of the auction users can see the new item.

You can also use real-time event generation for asynchronous processing. For example, an online store sends orders to different vendors (business to business), captures the transactions, and enters the orders into the vendors' systems. A user buys a book. The vendor enters a purchase order to the book publisher and sends a notification to the shipping company to pick up the book and deliver it. The book order can be completed as a purchase order transaction with JD Edwards EnterpriseOne, but the shipping request requires that the data is packaged into a commonly agreed-upon format for the shipping company to process.

15.2 Generating Real-Time Events

This section provide an overview about generating real-time events and discusses:

  • Real-time event APIs.

  • Example code for creating events.

15.2.1 Understanding Real-Time Event Generation

Events can be one of these:

  • Single Event

    Contains one partial event. A single event is useful if the receiver requires that events be generated per system call. You can also use single events with different event types.

  • Aggregate Event

    Contains multiple partial events. An aggregate event is useful if the receiver requires a document that contains multiple events. For example, a supply chain solution might want the complete sales order provided as one event that contains multiple partial events.

  • Composite Event

    Contains only single events. Composite events are useful if the customer has multiple receivers, some requiring single events and some requiring a complete event similar to an aggregate event.

15.2.2 Using Real-Time Event APIs

These APIs are available for you to generate real-time events:

  • jdeIEO_EventInit

  • jdeIEO_EventAdd

  • jdeIEO_EventGetCount

  • jdeIEO_EventGetData

  • jdeIEO_EventFreeData

  • jdeIEO_EventFinalize

  • jdeIEO_CreateSingleEvent

  • jdeIEO_IsEventTypeEnabled

15.2.3 Interoperability Event Interface Calls Sample Code

These steps and the accompanying example code illustrate how to create a single event:

  1. Design the data structure for the real-time event.

    typedef struct tagDSD55RTTEST 
       { 
       char    szOrderCo[6]; 
       char    szBusinessUnit[13]; 
       char    szOrderType[3]; 
       MATH_NUMERIC   mnOrderNo; 
       MATH_NUMERIC   mnLineNo; 
       JDEDATE     jdRequestDate; 
       char    szItemNo[27]; 
       char    szDescription1[31]; 
       MATH_NUMERIC   mnQtyOrdered;
       MATH_NUMERIC   mnUnitPrice; 
       MATH_NUMERIC   mnUnitCost;
       char    szUserID[11];
       } DSD55RTTEST, *LPDSD55RTTEST;
    
  2. Define the data structure object in the business function header file.

  3. Modify the business function source to call jdeIEO_CreateSingleEvent.

    JDEBFRTN(ID) JDEBFWINAPI RealTimeEventsTest (LPBHVRCOM lpBhvrCom, 
    LPVOID lpVoid, LPDSD55REALTIME lpDS)
    {
    /* Define Data Structure Object */
    DSD55RTTEST  zRTTest   = {0}; 
       IEO_EVENT_RETURN  eEventReturn   = eEventCallSuccess;
    IEO_EVENT_ID  szEventID   ={0};
    ()Populate required members
    
    /* Now call the API */ 
       szEventID = jdeIEO_CreateSingleEvent { lpBhvrCom,   
          "RealTimeEventsTest",    
          "JDERTOUT",    
          "SalesOrder",  
          "D55RTTEST",   
       &zRTTest,   
       sizeof(zRTTest),  
       0,   
       &eEventReturn   };
    
    /* Error in jdeFeedCallObjectEvent is not a critical error 
    and should only be treated as a warning */
       if( eEventReturn != eEventCallSuccess )
    { 
       /* LOG the Warning and return */ 
       return ER_WARNING;
    

This sample code illustrates how to create an aggregate event:

DSD55RTTEST zD55TEST01 = {0};
DSD55RTTEST zD55TEST02 = {0};
DSD55RTTEST zD55TEST03 = {0};
IEO_EVENT_RETURN eEventReturn = eEventCallSuccess;
IEO_EVENT_ID szEventID;

szEventID = jdeIEO_EventInit (lpBhvrCom, eEventAggregate, "MyFunction1",
 "JDESOOUT", "EventScope1", 0, &eEventReturn);
eEventReturn = jdeIEO_EventAdd (lpBhvrCom, szEventID, "MyFunction2", NULL,
 "D55TEST01", &zD55TEST01, sizeof(zD55TEST01),0);
eEventReturn = jdeIEO_EventAdd (lpBhvrCom, szEventID, "MyFunction3", NULL,
 "D55TEST02", &zD55TEST02, sizeof(zD55TEST02),0);
eEventReturn = jdeIEO_EventAdd (lpBhvrCom, szEventID, "MyFunction3", NULL,
 "D55TEST03", &zD55TEST03, sizeof(zD55TEST03),0);
eEventReturn = jdeIEO_EventFinalize (lpBhvrCom, szEventID,"MyFunction4",0);

This sample code illustrates how to create a composite event:

IEO_EVENT_RETURN    eEventReturn    = 0;
    IEO_EVENT_ID szEventID;


   eEventReturn = eEventCallSuccess;
   szEventID = jdeIEO_EventInit (lpBhvrCom, eEventComposite, "MyFunction1",
 "JDESOOUT","EventScope1",0,&eEventReturn,0);
   eEventReturn = jdeIEO_EventAdd ( lpBhvrCom, szEventID, "MyFunction2",
 "SODOCBEGIN", "D55TEST01", &zD55TEST01, sizeof(zD55TEST01),0);
   eEventReturn = jdeIEO_EventAdd ( lpBhvrCom, szEventID, "MyFunction3",
 "SOITEMADD", "EventScope3", "D55TEST02", &zD55TEST02, sizeof(zD55TEST02),0);
   eEventReturn = jdeIEO_EventFinalize (lpBhvrCom, szEventID, "MyFunction4",0);

Errors that are returned by the system calls might not be critical enough to stop the business process. The system flags non-critical errors as warnings and logs them in the log file.