Java introduced JShell, a REPL interactive shell. When I first heard of it was trying hard to find its real use cases and in this post try to list some of the use cases based on my experiences.
Use Case 1: Java Applications Production Support team for analyzing production database or logic issues
Challenge: Direct access to the production database or production log files for debugging production issues
My Job Function: I was fortunate enough to wear multiple hats in all my Java based enterprise applications software development. One such hat was production support engineer (not as a main job though) besides my core job function as a senior developer or architect.
Need (SQL / Log Files): During that period, debugging production issues was always a challenge because we will not have access to the production database to run SELECT SQL queries. Also, production log files used to be very huge and copying them to gateway machines was time consuming
How JShell can help for SQL queries: Through JShell production support team can use the same JDBC connection url that is used in the actual application and access the database. Alternatively, they can obtain the read-only database user access and run the queries. Advantage with this approach is, we can mingle both Java constructs like loops, if-else conditions, re-use application jar files along with SQL queries.
How JShell can help for Apache Log file analysis: Through JShell production support team can use load the remote Apache Access log files programmatically and analyze them for the issue on hand.
Use Case 2: Big Data ETL Workloads
Challenge: For a Big Data Platform Data Engineer, running a re-usable ETL pipeline that includes multiple actions including updating the ETL process metadata table for start of pipeline, invoking Apache Hive for initial clean-up, then invoke Sqoop or Apache Spark CLI interfaces and finally update ETL process metadata table with end of pipeline. This was a challenge at enterprises where Apache Oozie was not accepted as an ETL orchestration tool.
My Job Function: I played a key role in designing and developing an Enterprise Big Data Platform and one of its capability is to support re-usable ETL workflows. This means, through UI application teams defining ETL workflow parameter values and on execution of it a re-usable ETL workflow is execute using those parameters. Very common stuff, nothing fancy here. But the challenge was, most of the big data tech stack tools like Apache Hive or Apache Spark or Apache Impala have CLI access.
So, we used to have Groovy script developed because it compiles dynamically and such feature enables us to make changes on the fly (I mean on production system) for a critical issues.
How JShell can help for ETL workflows: Through JShell we can run the same ETL workflows without additional effort of using another scripting language (Groovy). Because JShell can access external classes through the class path and it can also run external scripts, we can develop a modular external scripts and make the whole big data platform ETL execution a Java-only solution instead of polygon of technologies.