GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — geode-examples/async at develop · apache/geode-examples

Expand file tree

/

async

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

async

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
scripts
scripts
 
 
src
src
 
 
README.md
README.md
 
 

README.md

Outline

Geode Asynchronous Event Queues & Listeners Example

This is a simple example that demonstrates asynchronous event queues and listeners.

An asynchronous event queue is an ordered collection of events that occurred on a region, e.g., create a new entry, update an existing entry. An asynchronous event listener has its method invoked from time to time with batches of events that have occurred previously. The method invocation occurs inside the JVM of the server and can not affect the operation on the region.

In this example, an asynchronous event queue is created for the region of incoming words. An asynchronous event listener is specified for that asynchronous event queue. Whenever the processEvents method is invoked on the listener, it uses the Levenshtein distance for each word to perform simplistic spell-checking. The proposed revision is the put in the outgoing region. A cache listener is installed that captures all of the creation events for the outgoing region and displays the proposal on the terminal. In other applications, the asynchronous event listener could perform some other calculation on the data.

This example assumes you have installed Java and Geode.

Steps

  1. From the geode-examples/async directory, build the example, and run unit tests.

     $ ../gradlew build
    
  2. Next start a locator, start two servers, create two regions, and deploy the asynchronous event listener.

     $ gfsh run --file=scripts/start.gfsh
    
  3. Run the example to put entries into the incoming region and get entries from the outgoing region.

     $ ../gradlew run
    
  4. Notice the output.

     that -> that
     teh -> the
     wil -> will
     i -> I
    
  5. Shut down the system.

     $ gfsh run --file=scripts/stop.gfsh
    
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.