Contributors Guide to the Jakarta EE 10 Galaxy
Contributors Guide to the Jakarta EE 10 Galaxy Reza Rahman Jakarta EE Ambassador, Author, Blogger, Speaker reza_rahman@lycos. com @reza_rahman
Jakarta EE • Java EE transitioned from JCP to Eclipse Foundation as Jakarta EE • Open governance, open source, open compatibility testing • Well defined specification process, clear IP flow, vendor-neutral open collaboration, level playing field • Key stakeholders maintained if not expanded including Oracle, IBM, Red Hat, Payara and VMware • Community participation and contribution key https: //jakarta. ee
The Importance of Jakarta EE • Jakarta EE is an important part of the Java ecosystem and cloud • 25 -35% of Java applications run on Jakarta EE application servers • Web. Logic, Web. Sphere/Liberty, JBoss EAP, Wild. Fly, Payara • 70 -80% of Java applications depend on at least one or more Jakarta EE APIs • Tomcat, Hibernate, Active. MQ, Jetty, Micro. Profile, Spring, Quarkus A healthy ecosystem continues to evolve, with a stable Jakarta EE core Quarkus and Micro. Profile are enjoying a notable increase in interest 2020 Jakarta EE Developer Survey: https: //outreach. jakartaee. org/2020 -developer-survey-report
Jakarta EE Evolution
Jakarta EE 9/9. 1 • Jakarta EE 9 moves all relevant specifications from javax to jakarta namespace • Remove older technologies • Primarily aimed for ecosystem to adapt to Jakarta • Some implementations are in place already • You should begin testing! • Jakarta EE 9. 1 will likely be released soon after adapting to Java SE 11 as opposed to Java SE 8 • Your contribution is welcome and needed to get work done on time! • Jakarta EE 10 will likely be delivered some time in 2021
Ambassadors’ Jakarta EE 10 Contribution Guide https: //docs. google. com/document/d/1 u. ZFBo. Iuj. XCcg. Qh. Czh_Zdl. KEsrs. V 0 y. VVIHz. BTI 3 us. F 8/edit? usp=sharing
Jakarta EE 10 Themes • CDI Alignment • @Asynchronous, @Schedule, @Lock, @Max. Concurrency in Concurrency, @Message. Listener in Messaging, @Roles. Allowed, @Run. As in Security Better CDI support in REST, Batch, Concurrency • Java SE Alignment • Completable. Future in Concurrency • • Bootstrap APIs for REST, Messaging Decoupling TCKs, modularization • Closing standardization gaps • • Security, Batch, Concurrency, Persistence, Transactions Microservices Profile • Innovation • • No. SQL, MVC, Configuration
Jakarta Concurrency • CDI based, modernized equivalents for @Asynchronous, @Schedule, @Lock • Adding @Max. Concurrency • Adding @Managed. Executor. Service. Definition • Add support for Completable. Future • CDI context propagation
@Asynchronous + Completable. Future @Asynchronous public Completable. Future<Confirmation> process. Payment(Order order) {. . . Confirmation status =. . . ; return Completable. Future<Confirmation>. completed. Future(status); } payment. Service. process. Payment(order). then. Accept( confirmation -> System. out. println(confirmation));
CDI Based @Lock @Application. Scoped @Lock(READ) public class Country. Info. Service {. . . public List<String> get. States(String country) { return country. States. Map. get(country); }. . . @Lock(WRITE) public void set. States(String country, List<String> states) { country. States. Map. put(country, states); } }
@Managed. Executor. Service. Definition + Completable. Future @Managed. Executor. Service. Definition( name = “java: app/concurrency/My. Executor. Service”, min-threads=“ 5”, max-threads=“ 25”, keepalive-time=“ 5000”, hung-task-threshold=“ 60000”) @Resource(name = "java: app/concurrency/My. Executor. Service") private Managed. Executor. Service executor; . . . Completable. Future<Long> stage = executor. new. Completable. Future(). then. Apply(function). then. Accept(consumer); stage. complete. Async(supplier);
@Service CDI Stereotype @Application. Scoped @Transactional @Max. Concurrency(DEFAULT) @Lock(READ) @Stereotype @Target(TYPE) @Retention(RUNTIME) public @interface Service {} @Service public class Default. Booking. Service implements Booking. Service {
Jakarta Messaging • CDI based, modernized @Message. Listener • Standalone bootstrap API • AMQP interoperability • Kafka interoperability
@Message. Listener Example @Application. Scoped @Max. Concurrency(10) public class Handling. Event. Registration. Attempt. Consumer { @Message. Listener( destination. Lookup="jms/Handling. Event. Registration. Attempt. Queue", selector="source = 'mobile'", batch. Size=10, retry=5, retry. Delay=7000, order. By=TIMESTAMP) public void on. Event. Registration. Attempt( Handling. Event. Registration. Attempt. . . attempts) {. . . } }
Bootstrap API for Jakarta Messaging Jms. Container container = Jms. Container. Factory. new. Instance(); . . . JMSContext jms. Context = container. get. Jms. Context(); Destination handling. Event. Queue = container. get. Destination( “jms/Handling. Event. Registration. Attempt. Queue” true); . . . jms. Context. create. Producer(). set. Disable. Message. ID(true). set. Disable. Message. Timestamp(true). set. String. Property("source", source). send(handling. Event. Queue, attempt); . . . container. close();
Jakarta Security • CDI based, modernized equivalents for @Roles. Allowed and @Run. As • OAuth 2. 0, Open. ID Connect, JWT support • EL enabled authorization annotation
Modern Security Providers @Open. Id. Connect. Identity. Store. Definition( client. Id=“${client. id}”, client. Secret=“${client. secret}”, discovery. Endpoint=“https: //. . . /openid-configuration”, user. Name. Attribute=“preferred_username”) @Jwt. Identity. Store. Definition( jwks. Uri="https: //. . . /keys", issuer="https: //. . . /${tenant. id}/v 2. 0", audiences="${client. id}", user. Name. Attribute="preferred_username") @OAuth 2 Identity. Store. Definition( client. Id="${client. id}", client. Secret="${client. secret}", token. Endpoint. Auth. Method="client_secret_post", authorization. Endpoint="https: //. . . /authorize", user. Name. Attribute="preferred_username", website="https: //. . . /authentication/")
EL Enabled Authorization Annotation @Authorized("has. Roles('Manager') && schedule. office. Hours") public void transfer. Funds(); @Authorized("has. Attribute('direct. Reports', employee. Id)") public double get. Salary(long employee. Id);
Other Possibilities • Jakarta Persistence • Make persistence. xml optional/empty marker • More SQL features in JPQL such as sub-selects • JCache as a second-level cache provider • Jakarta REST • @Inject instead of @Context Standalone bootstrap API • Jakarta Batch • • CDI alignment Java job definition API as alternative to XML • Jakarta Transactions • • Standardize common performance optimizations
Job Definition API Example Job job = new Job. Builder(job. Name). property("jobk 1", "J"). listener("job. Listener 1", new String[]{"job. Listenerk 1", "#{job. Parameters['job. Listener. Prop. Val']}"}, . step(new Step. Builder(step. Name). properties(new String[]{"stepk 1", "S"}, new String[]{"stepk 2", "S"}). batchlet(batchlet 1 Name, new String[]{"batchletk 1", "B"}, new String[]{"batchletk 2", "B"}). listener("step. Listener 1", step. Listener. Props). stop. On("STOP"). restart. From(step. Name). exit. Status(). end. On("END"). exit. Status("new status for end"). fail. On("FAIL"). exit. Status(). next. On("*"). to(step 2 Name). build()). . build();
Jakarta MVC • Standard action-based web framework • Jakarta Faces continues to evolve separately • Model • CDI, Bean Validation • View • Facelets, Jakarta Server Pages • Controller • Majority of work here • Based on Jakarta REST
Jakarta MVC Example @Controller @Path("/") @View("my-index. xhtml") public class Bookstore { @Inject private Models model; @Inject private Book. Service service; . . . @GET public void index() {. . . model. put(“books”, books); } }
Jakarta No. SQL • Specification for accessing No. SQL databases • Layers of flexible abstractions • Communication API akin to JDBC • Mapping/template API akin to JPA • Repository API akin to Delta. Spike/Spring Data • API variants by No. SQL taxonomy • Key-value pair, column family, document and graph • Bean validation, externalized configuration
Jakarta No. SQL Example @Entity public class Order { @Id private long id; @Column @Not. Blank private String description; @Column @Not. Empty private List<Order. Line> order. Lines; @Column @Not. Null private Customer customer; @Column @Not. Null private Address address; template. insert(order); . . . Document. Query query = select(). from("Order"). where("description"). like("^Pinball"). build(); logger. info("Found orders for pinball: " + template. select(query). count());
Configuration • Externalizing application configuration • Built-in stores • Property files, Java system properties, environment variables • Extensible stores • Kubernetes secrets • Secure cloud storage • No. SQL stores • @Inject into code • Reference in EL • Reference in XML • Micro. Profile alignment
Configuration Examples @Inject @Config. Property(name = “admin. group”, default. Value=“admin”) private String admin. Group; persistence. provider=org. hibernate. ejb. Hibernate. Persistence persistence. datasource=java: app/jdbc/Cargo. Tracker. Database persistence. schema. generation. database. action=create <data-source> <name>java: app/jdbc/Cargo. Tracker. Database</name> <class-name>org. apache. derby. jdbc. Embedded. Driver</class-name> <url>jdbc: derby: ${temp. dir}/cargo-tracker-database</url> </data-source>
Ways of Contributing • Follow Jakarta EE technologies that interest you and share opinion • https: //jakarta. ee/connect/mailing-lists/ • Advocate for a specific change or feature • https: //jakarta. ee/projects/ • Help implement a change in API, specification, TCK or implementation • Sign Eclipse Contributor Agreement • https: //www. eclipse. org/legal/ECA. php • Becoming a committer comes much later • Engage an Ambassador if needed • https: //jakartaee-ambassadors. io
Beyond Jakarta EE 10 • Persistence alignment with Java SE Records • JSON schema support • Reactive/NIO support • Servlet, REST, MVC • Persistence - requires reactive/NIO JDBC, ideally in Java SE • Making modularity and embedded runtimes required
Summary • Jakarta EE 8, 9, 9. 1 very significant for the future of Java • Many possible important changes for Jakarta EE 10 and beyond • The time to get involved is now!
Resources • Jakarta EE Community alias • https: //accounts. eclipse. org/mailing-list/jakarta. ee-community • Jakarta EE Twitter handle • @Jakarta. EE • Jakarta Tech Talks • https: //www. meetup. com/jakartatechtalks_
- Slides: 31