DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Data Engineering
  3. Databases
  4. Oracle Offline Persistence Toolkit — Controlling Online Replay

Oracle Offline Persistence Toolkit — Controlling Online Replay

Coming back online. Check out this application of a previous article that demonstrates how to test the online replay functions of an application.

Andrejus Baranovskis user avatar by
Andrejus Baranovskis
·
Aug. 13, 18 · Presentation
Like (1)
Save
Tweet
Share
2.38K Views

Join the DZone community and get the full member experience.

Join For Free

A few months ago I had a post about Oracle Offline Persistence toolkit, which integrates well with Oracle JET (JavaScript toolkit from Oracle) — Oracle JET Offline Persistence Toolkit — Offline Update Handling. I'm back to this topic with a sample application upgraded to JET 5.1 and the offline toolkit upgraded to 1.1.5. In this post, I will describe how to control online replay by filtering out some of the requests, to be excluded from the replay.

The source code is available on GitHub. Below I describe changes and functionality in the latest commit.

To test online replay, go offline and execute some actions in the sample app — change a few records and try to search by first name, and try to use page navigation buttons. You will be able to save changes in offline mode, but if this is your first time loading an app and data from other pages wasn't fetched yet, then page navigation would not bring any new results in offline mode (make sure to load more records while online and then go offline):


In the online replay manager, I'm filtering out GET requests intentionally. Once I go online, I replay only the PATCH requests. This is done mainly for testing, to learn how to control the replay process. PATCH requests are executed during replay:


Printing out in the log, each GET request was removed from the replay loop:


Replay the implementation (I would recommend reading the Offline Persistence Toolkit usage doc for more info):


This code is executed, after transitioning to online status. Calling the getSyncLog  method from Sync Manager returns a list of requests pending replay. Promise returns function with array of requests waiting for online replay. I have marked the function to be async, which allows it to implement a sequential loop, where each GET request will be removed one by one in order. This is needed, since removeRequest  from Sync Manager is executed in promise and the loop would complete too late — after we pass execute replay phase. Read more about sequential loop implementation in JS, when a promise is used — JavaScript — Method to Call Backend Logic in Sequential Loop. Once all GET requests are removed, we execute the sync method to force all remaining requests in queue to be replayed.

Persistence (computer science) Requests

Published at DZone with permission of Andrejus Baranovskis, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Spring Boot, Quarkus, or Micronaut?
  • 5 Software Developer Competencies: How To Recognize a Good Programmer
  • Front-End Troubleshooting Using OpenTelemetry
  • Key Elements of Site Reliability Engineering (SRE)

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: