This document generally relates to methods and systems for use with computer programming.
Certain types of programming languages allow for eventing. Eventing provides a mechanism wherein certain occurrences at runtime of a computer program (called events) can trigger additional steps. For example, the Advanced Business Application Programming (ABAP) language includes such an eventing mechanism. Eventing mechanisms in current programming languages have fallen into two categories. The first involves assigning each event type to a dedicated function or method as a handler. Such a system requires that the creator of the programming language anticipate all the different event types that may be encountered by the program. The second involves utilizing remote function calls, which are remote execution of functions in an external system. In some systems, it is even possible to specify conditions under which the events should be received. These conditions are also known as “wait” conditions. However, due to the modular characteristics of some applications, it may be necessary that each layer express its interest in the consumption of event types while still being able to control the consumption order of queued events for the application. This is not possible using remote function calls.
The present disclosure is illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements and in which:
The description that follows includes illustrative systems, methods, techniques, instruction sequences, and computing machine program products that embody illustrative embodiments. In the following description, for purposes of explanation, numerous specific details are set forth in order to provide an understanding of various embodiments of the inventive subject matter. It will be evident, however, to those skilled in the art that embodiments of the inventive subject matter may be practiced without these specific details. In general, well-known instruction instances, protocols, structures, and techniques have not been shown in detail.
In an example embodiment, a statement is defined that allows a programmer to specify a method for monitoring an event channel until some logical expression is satisfied. In a further example embodiment, the statement may also contain a timeout value after which the system stops waiting for the logical expression to be satisfied. This allows for a generic event handler without requiring the use of remote function calls.
In an example embodiment, the statement is defined as an Advanced Business Application Programming language (ABAP) statement. ABAP is a high-level programming language used for programming application servers. ABAP programs run on an application server and are persisted inside a database. Within the database, the ABAP code exists in two forms: source code, which can be viewed and edited using ABAP workbench tools, and generated code, which is a binary runtime representation.
In ABAP, the (asynchronous) remote function calls trigger the event processing. Once the (asynchronous) remote function call is terminated, then the event handler is executed. The event handler is registered with the addition “CALLING <meth> AT END OF TASK and PERFORMING <perf> AT END OF TASK of the CALL FUNCTION <func> STARTING NEW TASK” statement. The event handler itself is executed in the session of the event loop. The results of the asynchronous remote function call can be processed in the event handler with the RECEIVE RESULTS statement. In an example embodiment, source code in the one or more databases 106 is modified so that the dispatcher 110 in the first application server instance 104 can monitor event channels until a particular logical expression is satisfied (or a timeout period expires).
In the ABAP embodiment, this means that all currently defined event channels, as well as additional channels that may be implemented such as a push channel and a messaging channel, can be monitored in addition to a remote function call. Thus, this essentially turns the dispatcher 110 into an advanced event dispatcher. An application is able to express conditions under which the events in the event channels are received. The application is able to decide how long and how many events should be processed before the execution of the application continues. Furthermore, the application can optionally specify a waiting time for events until the condition is fulfilled. As such, the application is allowed to compensate for the fact that no guarantee exists that a publisher will raise these events of interest.
In an example embodiment, all applications running in the same context support the consumption of events from the same event channels. Thus, in this embodiment, no application instance 104 will be unable to monitor the channel. The new statement provided in the source code within the database(s) allows for this to be accomplished. This allows certain events, such as writing a log or increasing a trace level, to be consumed by any application instance 104, 106 and/or component.
In an example embodiment, a new ABAP statement (or library) is provided. This statement may have the following syntax (or a similar context):
WAIT FOR <event channels> UNTIL <logical expression> [UP TO <timeout> SECONDS]
The placeholder <event channels> specifies any kind of event channel in which the application is interested. All other events that are not expressed in the <event channels> may be queued until either the application enables delivery of the events (e.g., using a WAIT with the proper event channels), the event deregisters the event, or the application terminates. Based on the specified event channels, the associated incoming events are executed and the logical expression <logical expression> is checked after each delivery. The statement may terminate either because the expression is fulfilled or a timeout value is reached.
In an example embodiment (as in ABAP Objects), triggering and handling an event means that certain methods act as triggers and trigger events, to which other methods—the handlers—react. This means that the handler methods are executed when the event occurs. To trigger an event, a class can declare the event in its declaration part and trigger the event in one of its methods.
In addition to being sold or licensed via traditional channels, embodiments may also be deployed by Software-as-a-Service (SaaS), application service providers (ASP), or utility computing providers. The computer may be a server computer, a personal computer (PC), a tablet PC, a set-top box (STB), a personal digital assistant (PDA), cellular telephone, or any processing device capable of executing a set of instructions 424 (sequential or otherwise) that specify actions to be taken by that device. Further, while only a single computer is illustrated, the term “computer” shall also be taken to include any collection of computers that individually or jointly execute a set (or multiple sets) of instructions 424 to perform any one or more of the methodologies discussed herein.
The example computer processing system 400 includes a processor 402 (e.g., a central processing unit (CPU), a graphics processing unit (GPU) or both), main memory 404 and static memory 406, which communicate with each other via bus 408. The computer processing system 400 may further include a graphics display unit 410 (e.g., a plasma display, a liquid crystal display (LCD) or a cathode ray tube (CRT)). The computer processing system 400 also includes an alphanumeric input device 412 (e.g., a keyboard), a cursor control device 414 (e.g., a mouse, touch screen, or the like), a storage unit 416, a signal generation device 418 (e.g., a speaker), and a network interface device 420.
The storage unit 416 includes machine-readable medium 422 on which is stored one or more sets of instructions 424 and data structures (e.g., software) embodying or utilized by any one or more of the methodologies or functions described herein. The instructions 424 may also reside, completely or at least partially, within the main memory 404 and/or within the processor 402 during execution thereof by the computer processing system 400, the main memory 404 and the processor 402 also constituting machine-readable, tangible media.
The instructions 424 may be further transmitted or received over a network 426 via a network interface device 420 utilizing any one of a number of well-known transfer protocols (e.g., HTTP).
While the machine-readable medium 422 is shown in an example embodiment to be a single medium, the term “machine-readable medium” should be taken to include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of instructions 424. The term “machine-readable medium” shall also be taken to include any medium that is capable of storing, encoding or carrying a set of instructions 424 for execution by the computer processing system 400 and that cause the computer processing system 400 to perform any one or more of the methodologies of the present application, or that is capable of storing, encoding or carrying data structures utilized by or associated with such a set of instructions 424. The term “machine-readable medium” shall accordingly be taken to include, but not limited to, solid-state memories, and optical and magnetic media.
While various implementations and exploitations are described, it will be understood that these embodiments are illustrative and that the scope of the claims is not limited to them. In general, techniques for maintaining consistency between data structures may be implemented with facilities consistent with any hardware system or hardware systems defined herein. Many variations, modifications, additions, and improvements are possible.
Plural instances may be provided for components, operations or structures described herein as a single instance. Finally, boundaries between various components, operations and data stores are somewhat arbitrary, and particular operations are illustrated in the context of specific illustrative configurations. Other allocations of functionality are envisioned and may fall within the scope of the claims. In general, structures and functionality presented as separate components in the exemplary configurations may be implemented as a combined structure or component. Similarly, structures and functionality presented as a single component may be implemented as separate components. These and other variations, modifications, additions and improvements fall within the scope of the claims.
This application is a continuation of prior application Ser. No. 13/938,092, filed on Jul. 9, 2013, which is incorporated by reference herein in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | 13938092 | Jul 2013 | US |
Child | 14465444 | US |