<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aleks Seovic on Medium]]></title>
        <description><![CDATA[Stories by Aleks Seovic on Medium]]></description>
        <link>https://medium.com/@aseovic?source=rss-48d954472abc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*eTIHw_lbiq1bW-uinwlYhg.png</url>
            <title>Stories by Aleks Seovic on Medium</title>
            <link>https://medium.com/@aseovic?source=rss-48d954472abc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 00:47:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aseovic/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Announcing Coherence CE 26.07: Unified Persistence, Virtual Threads, and More]]></title>
            <link>https://medium.com/oracle-coherence/announcing-coherence-ce-26-07-unified-persistence-virtual-threads-and-more-cf5cfad33cf4?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf5cfad33cf4</guid>
            <category><![CDATA[persistence]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[announcements]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Fri, 18 Sep 2026 01:55:08 GMT</pubDate>
            <atom:updated>2026-09-18T01:55:08.865Z</atom:updated>
            <content:encoded><![CDATA[<h4>A purpose-built persistence engine, new concurrency options, stronger serialization security, and a new quarterly release cadence.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qN---GuRPRQthf5LRSfdDA.png" /></figure><p>The Coherence team is pleased to announce the availability of <a href="https://github.com/oracle/coherence/releases/tag/26.07">Coherence Community Edition (CE) 26.07</a>.</p><p>Release 26.07 requires Java 17 or later, with some features requiring Java 21 or later. It is one of our most significant CE releases in recent years, led by Unified Persistence: a new journal-based persistence engine designed specifically for Coherence. The release also adds an opt-in Virtual Daemon Pool based on Java virtual threads, makes the existing platform-thread pools smarter under blocking workloads, and introduces a comprehensive serialization-hardening framework.</p><p>Release artifacts are available from:</p><p>- <a href="https://github.com/oracle/coherence/releases/tag/26.07">Source code and complete release notes</a> on GitHub<br>- <a href="https://central.sonatype.com/artifact/com.oracle.coherence.ce/coherence-bom/26.07">Artifacts</a> on Maven Central<br>- <a href="https://github.com/oracle/coherence/pkgs/container/coherence-ce">Container images</a> on GitHub<br>- Documentation guides for <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/01_unified_persistence.adoc">Unified Persistence</a>, <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/02_daemon_pool_dynamic_resizing.adoc">Daemon Pool Dynamic Resizing</a>, <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/03_virtual_daemon_pool.adoc">Virtual Daemon Pool</a>, and <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/04_serialization_hardening.adoc">Serialization Hardening</a></p><h3>A new quarterly release cadence</h3><p>With 26.07, Coherence CE is moving to a quarterly release cadence aligned with the commercial Coherence patch schedule.</p><p>Going forward, CE release trains will be identified by the target quarter: <strong>YY.01</strong>, <strong>YY.04</strong>, <strong>YY.07</strong>, and <strong>YY.10</strong>, corresponding to commercial January, April, July, and October CPUs. The identifier is a release-train name rather than a promise that the release will be published during that exact calendar month — CE release may arrive a month or so later, giving us time to incorporate the latest security fixes from the corresponding commercial patch before publishing the Community Edition release.</p><p>This change gives CE users a more predictable flow of enhancements and fixes while keeping Community Edition closely aligned with the security posture of our commercial releases.</p><h3>Unified Persistence</h3><p>The headline feature in 26.07 is <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/01_unified_persistence.adoc">Unified Persistence</a>, a new persistence engine built around Coherence’s partitioned architecture and access patterns.</p><p>The existing Berkeley DB-based persistence implementation has served Coherence well, but it is a general-purpose embedded database sitting underneath a system that already knows how its data is partitioned, replicated, transferred, and recovered. Unified Persistence removes that mismatch and replaces it with a storage engine purpose-built for Coherence.</p><p>Every mutation is appended to a journal owned by a specific partition. An in-memory radix index maps each cache key to the precise journal file and byte offset containing its current value, allowing direct point reads without traversing an on-disk database index. During recovery, Coherence loads a checkpoint of that radix index and then replays only the journal entries written after the checkpoint. The result is a deliberately simple I/O model: append-oriented writes, indexed reads, and mostly sequential recovery.</p><p>Snapshots benefit from the same design. Completed journal files are immutable, so on file systems that support hard links, Coherence can link those files into a snapshot instead of copying them. Snapshot creation is therefore nearly instantaneous and initially consumes almost no additional disk space. Background compaction reclaims space from superseded and deleted entries without changing the append-only write path.</p><p>Unified Persistence supports three deployment models:</p><p>1. <strong>Side-channel persistence</strong> is the simplest migration path from Berkeley DB. Keep the existing backing-map configuration and change the persistence environment to use the journal engine.<br>2. <strong>Unified backing map</strong> uses <strong>&lt;journal-scheme&gt;</strong> as the primary backing map. The journal becomes the authoritative cache store, eliminating the duplicate write through a separate persistence side channel.<br>3. <strong>Journal backup map</strong> stores backup partitions in the journal as well. Combined with <strong>&lt;journal-scheme&gt;</strong>, this provides a fully unified model with one durable write for the primary and one for the backup.</p><p>All three models participate in the standard Coherence persistence lifecycle, including active, active-backup, active-async, and on-demand persistence; snapshots and archival; partition transfer; and recovery. Existing applications can migrate either through a controlled import from a Berkeley DB snapshot or through a rolling restart in which Berkeley DB and journal members coexist temporarily while partitions move to the new members.</p><p>Operators also get a dedicated journal persistence MBean for open extents, compaction progress, and recovery summaries, plus Java Flight Recorder events that break recovery into checkpoint-load, journal-scan, journal-replay, and total phases.</p><h3>Virtual Daemon Pool</h3><p>Coherence 26.07 adds an opt-in <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/03_virtual_daemon_pool.adoc">Virtual Daemon Pool</a> for Java 21 and later. It runs service tasks on Java virtual threads while preserving Coherence’s ordering and request-processing semantics.</p><p>Virtual threads are particularly useful when a service performs blocking work such as persistence I/O, network calls, or <strong>CacheLoader</strong> and <strong>CacheStore</strong> operations. When a virtual thread blocks, its carrier thread is released to run other work, so the service does not need a large pool of operating-system threads simply to absorb stalls.</p><p>Coherence also preserves same-key mutation ordering without parking a set of workers behind the same entry lock. Mutating tasks for a key are routed through a lightweight per-key mailbox and drained in order by a single virtual thread. Independent keys continue to make progress concurrently.</p><p>The Virtual Daemon Pool is enabled per service:</p><pre>&lt;distributed-scheme&gt;<br>  &lt;scheme-name&gt;orders-distributed&lt;/scheme-name&gt;<br>  &lt;service-name&gt;OrdersService&lt;/service-name&gt;<br>  &lt;daemon-pool&gt;virtual&lt;/daemon-pool&gt;<br>  &lt;task-limit&gt;10000&lt;/task-limit&gt;<br>  &lt;backing-map-scheme&gt;<br>    &lt;local-scheme/&gt;<br>   &lt;/backing-map-scheme&gt;<br>&lt;/distributed-scheme&gt;</pre><p>The optional <strong>&lt;task-limit&gt;</strong> provides an aggregate ceiling when an application needs to protect memory or a downstream resource. More targeted admission windows for ordinary, read-only, and same-key mailbox work adapt automatically to the live workload.</p><p>The platform-thread pool remains the default and continues to be the best choice for many short, CPU-bound operations. Virtual threads are an architectural choice, not a universal performance switch: enable them on services whose blocking, hot-key contention, or substantial task bodies can amortize their scheduling cost, and validate with a representative workload.</p><h3>Smarter platform-thread pools</h3><p>The traditional platform-thread <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/02_daemon_pool_dynamic_resizing.adoc">Daemon Pool</a> also gets a major upgrade in 26.07.</p><p>Daemon Pools continue to resize between their configured minimum and maximum, but they now use throughput, utilization, queue pressure, worker CPU activity, and association width to distinguish CPU-bound work from blocking or I/O-bound work. A CPU-bound service stays near the useful processor count. A service whose workers spend significant time blocked can probe beyond that point, but Coherence retains the added concurrency only when measured throughput improves. Ineffective growth is automatically rolled back.</p><p>Pools react quickly to bursts, shrink gradually with a cooldown to avoid oscillation, and continually seek a useful operating point rather than treating the processor count as a universal ceiling. If no maximum is configured, Coherence derives a safe process-wide worker budget from available processors, memory, estimated thread-stack cost, and operating-system limits. Explicitly configured finite limits remain authoritative.</p><p>This gives existing applications better behavior under mixed and blocking workloads without requiring them to adopt virtual threads or redesign their service configuration.</p><h3>Serialization hardening</h3><p>Release 26.07 introduces a common <a href="https://github.com/oracle/coherence/blob/v26.07/prj/docs/core/04_serialization_hardening.adoc">Serialization Hardening</a> model across Java serialization, POF, <strong>ExternalizableLite</strong>, dynamic classes and lambdas, and remotely executable objects.</p><p>JEP 290 filters are valuable, but they apply to <strong>ObjectInputStream</strong>; most Coherence traffic uses other serialization paths. The new framework applies a shared allowlist and policy model across those paths, integrates with JEP 290 where Java serialization is used, validates dynamic class and lambda bytecode, tightens POF type handling, and distinguishes between classes that may be deserialized and classes that may be executed on behalf of a remote request.</p><p>Applications can generate <strong>META-INF/coherence/security-config.xml</strong> during a Maven or Gradle build. Classes annotated with <strong>@Remote.Allowed</strong> or <strong>@PortableType</strong> are added to the serialization allowlist, while <strong>@Remote.Executable</strong> separately classifies types that the server may execute on behalf of a remote request. Each application module contributes its own generated configuration, and Coherence merges those resources at runtime.</p><p>Compatibility remains the default so existing deployments can upgrade without an immediate configuration change. The recommended migration path is to generate the security configuration, annotate legitimate wire payloads, exercise the application in compatibility mode, inspect <strong>would_reject</strong> telemetry, and then test with:</p><pre>-Dcoherence.security.mode=hardened</pre><p>Once enabled, hardened mode fails closed at supported serialization and remote-execution boundaries. JMX and metrics expose route-aware policy decisions, making it possible to see which class, boundary, and reason caused a rejection before changing a policy.</p><h3>More performance, observability, and reliability improvements</h3><p>The four headline features are accompanied by several additional enhancements:</p><p>- <strong>Higher Extend proxy concurrency:</strong> independent TCP client connections now use connection-affine decode pipelines instead of sharing a single serialized acceptor path. Ordering is preserved within each connection while multiple connections are decoded concurrently.<br>- <strong>More efficient Java Extend clients:</strong> default initiator input and output buffers increase from five bytes to 8 KiB, improving throughput and CPU efficiency without changing the wire protocol.<br>- <strong>Lower MessageBus contention:</strong> lock contention on the connection during <strong>send()</strong> operations has been eliminated.</p><p>The release also contains eleven bug fixes across persistence, Paged Topics, MicroProfile Metrics, management connectivity, partition migration, write-behind caches, query execution, and the transport layer. See the <a href="https://github.com/oracle/coherence/releases/tag/26.07">complete release notes</a> for the full list, along with third-party dependency updates to ASM 9.10.1, Jackson 2.21.5, JLine 3.30.16, Netty 4.1.136.Final, and OpenTelemetry 1.64.0.</p><h3>Get Coherence CE 26.07</h3><p>The easiest way to manage Coherence dependencies is with the BOM:</p><pre>&lt;dependencyManagement&gt;<br> &lt;dependencies&gt;<br>   &lt;dependency&gt;<br>     &lt;groupId&gt;com.oracle.coherence.ce&lt;/groupId&gt;<br>     &lt;artifactId&gt;coherence-bom&lt;/artifactId&gt;<br>     &lt;version&gt;26.07&lt;/version&gt;<br>     &lt;type&gt;pom&lt;/type&gt;<br>     &lt;scope&gt;import&lt;/scope&gt;<br>   &lt;/dependency&gt;<br> &lt;/dependencies&gt;<br>&lt;/dependencyManagement&gt;<br>```</pre><p>Container users can pull the release from GitHub Container Registry:</p><pre>docker pull ghcr.io/oracle/coherence-ce:26.07</pre><p>With Unified Persistence, virtual-thread execution, adaptive platform-thread concurrency, and stronger security controls, Coherence CE 26.07 delivers meaningful improvements across the full data path: how data is stored, how work is scheduled, how remote payloads are trusted, and how the system is operated.</p><p>We look forward to hearing how you put it to work.</p><p><em>Coherence is the world’s first and leading in-memory data grid, enabling the performance and scalability of mission-critical applications. Coherence Community Edition is free and open source under the Universal Permissive License.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf5cfad33cf4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/announcing-coherence-ce-26-07-unified-persistence-virtual-threads-and-more-cf5cfad33cf4">Announcing Coherence CE 26.07: Unified Persistence, Virtual Threads, and More</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Micronaut Coherence 1.0.0 Released]]></title>
            <link>https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-released-95d16120d34c?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/95d16120d34c</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[announcements]]></category>
            <category><![CDATA[micronaut]]></category>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[news]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Thu, 08 Jul 2021 11:44:44 GMT</pubDate>
            <atom:updated>2021-07-08T11:44:44.261Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce immediate availability of Micronaut Coherence 1.0.0, the official integration of <a href="https://coherence.community/">Oracle Coherence</a> with <a href="https://micronaut.io/">Micronaut Framework</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jbEQbmRIc8BXTEoP.png" /></figure><p>Micronaut Coherence provides support for a number of Micronaut features:</p><h3>Dependency Injection of Coherence Objects</h3><p>The micronaut-coherence module provides bean factories for commonly used Coherence objects, such as Cluster, Session, NamedMap, NamedCache, NamedTopic, and many others, which allows you to <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#injection">easily inject those objects</a> into your application classes.</p><h3>Listeners for Coherence Events</h3><p>The micronaut-coherence module also provides support for Coherence <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#coherenceEvents">server-</a> and <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#mapEvents">client-side</a> events via Micronaut event listeners.</p><h3>Micronaut Data Support</h3><p>The micronaut-coherence-data module alows you to use <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#repository">Micronaut Data with Coherence as a back end data store</a>. Both synchronous and asynchronous repositories are fully supported, which allows you to access Coherence in a way that is best suited for your application.</p><h3>Micronaut Messaging Support</h3><p>The micronaut-coherence module provides support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#messagingWithTopics">Micronaut Messaging using Coherence Topics</a>.</p><h3>Micronaut Caching Support</h3><p>The micronaut-coherence-cache module adds support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#cache">using Coherence as a back end for Micronaut Cache</a>.</p><h3>Micronaut Distributed Config Support</h3><p>The micronaut-coherence-distributed-configuration module adds support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#distributedConfiguration">using Coherence as a store for Micronaut Distributed Configuration</a>.</p><h3>Micronaut HTTP Sessions Support</h3><p>The micronaut-coherence-session module adds support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#coherenceHttpSessions">using Coherence as a store for Micronaut HTTP Sessions</a>.</p><p>The goal for the Micronaut Coherence integration is to make development of Micronaut applications and microservices with a Coherence back end as simple as possible, and we believe we’ve made great strides towards it in this release.</p><p>To see how many of the features above work together, check out <a href="https://github.com/coherence-community/todo-list-example/tree/master/java/micronaut-server">Micronaut server implementation</a> of our <a href="https://github.com/coherence-community/todo-list-example">To Do List sample application</a>.</p><p>You can run Micronaut services and Coherence cluster members in the same or different JVMs, access Coherence using Micronaut Data, use Micronaut Messaging to publish and consume messages stored in Coherence NamedTopics, and use Coherence as a back end data store for Micronaut Caching, Distributed Config, and HTTP Sessions.</p><p>The complete documentation for the currently supported features is available <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#introduction">here</a>.</p><p>Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95d16120d34c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-released-95d16120d34c">Micronaut Coherence 1.0.0 Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coherence CE 21.06 Released]]></title>
            <link>https://medium.com/oracle-coherence/coherence-ce-21-06-released-d5181b47020d?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5181b47020d</guid>
            <category><![CDATA[announcements]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[news]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Thu, 01 Jul 2021 13:46:45 GMT</pubDate>
            <atom:updated>2021-07-01T13:46:45.397Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce immediate availability of Coherence CE 21.06, the third major release since Coherence CE was open sourced in June of last year.</p><p>And what a busy year it has been… Coherence CE 21.06 contains a number of brand new features, such as <a href="https://coherence.community/21.06/docs/#/docs/core/05_repository">Repository API</a>, <a href="https://coherence.community/21.06/docs/#/docs/core/06_durable_events">Durable Events</a>, <a href="https://coherence.community/21.06/docs/#/docs/core/08_non_blocking">Non-Blocking Entry Stores</a>, and <a href="https://coherence.community/21.06/docs/#/docs/core/07_partition_events_logging">Partition Events Logging</a>.</p><h3>Repository API</h3><p>The Repository API implements <a href="https://martinfowler.com/eaaCatalog/repository.html">Repository pattern</a> and enables another way of accessing data stored in Coherence. It provides a higher-level API on top of the existing NamedMap API, effectively making many common data access operations one-liners. It is particularly well suited for applications that use Domain Driven Design (DDD), although it is certainly not limited only to those.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ksFWXv1O9q_00tYM.png" /></figure><p>It provides both a synchronous implementation, and an asynchronous, CompletableFuture-based repository implementation, which allows you to access data managed by Coherence in a non-blocking fashion, as well as to stream potentially large result sets without incurring the cost of accumulating all the results in a single process.</p><p>The Repository API was introduced to make the implementation of data access layer within the applications easier, regardless of which framework you use to implement applications that use Coherence as a data store. It works equally well for plain Java applications and applications that use CDI, making repository implementations trivial. It is also the foundation for our <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#repository">Micronaut Data</a> and <a href="https://spring.coherence.community/3.0.0-SNAPSHOT/refdocs/reference/html/spring-data.html#spring-data">Spring Data</a> repository implementations.</p><h3>Durable Events</h3><p>Coherence is an observable data source, which allows client applications to observe data changes as they occur, via map listeners. Customers love this feature, and use it to implement all kinds of functionality within their applications, from basic data synchronization across processes, to sophisticated real-time updates of the application UI.</p><p>However, the client-side events, until now, have been transient in nature: if a client disconnects, it is likely that it will miss some of the events, and will only receive new events that occurred after the re-connection and subsequent event listener re-registration.</p><p>Durable Events eliminate lost events by allowing clients to replay events from a particular version, or even from the very beginning of the event stream! The memory pressure in the case of slow consumers is also reduced, as the events are persisted to disk, within the same partition that the event occurred in.</p><p>The feature is currently experimental and we do not recommend using it in production. There are a number of enhancements that we will be working on in the upcoming releases to make this feature production grade, including persistent backups, Extend and gRPC client support, and configurable retention polices.</p><p>However, we encourage you to try it out and provide feedback that will allow us to make it rock solid and production-ready for one of the upcoming releases.</p><h3>Non-Blocking Entry Stores</h3><p>Coherence supports integration with other data sources via cache or entry stores, allowing you to lazily load data into Coherence from an external system of record, and to update the external system whenever the data in Coherence itself changes.</p><p>Most backend systems that you would want to integrate with have traditionally provided only blocking APIs, so the existing entry store contracts are tailored for that use case and assume that a blocking API is used to both load and store the data, tying up Coherence worker threads in the process.</p><p>However, in recent years many of these traditional data stores have added support for reactive and non-blocking APIs, and systems that are non-blocking by their very nature, such as Apache Kafka, have become increasingly popular, making traditional Coherence contracts for interfacing with external systems less than ideal.</p><p>Coherence CE 21.06 allows you to implement non-blocking entry stores that seamlessly integrate with modern, non-blocking data stores. This eliminates the overhead of queuing writes, and frees up Coherence worker threads to perform other tasks.</p><p>We hope you’ll find the new features useful, and that they will make implementation of your Coherence applications even easier. For more details on each of the features above, check out <a href="https://coherence.community/21.06/docs/#/docs/about/01_overview">the latest documentation</a>.</p><p>There were also a number of improvements and bug fixes that went into 21.06 release. One standout is the significant refactoring of the <a href="https://coherence.community/21.06/docs/#/docs/topics/01_introduction">Topics</a> feature, which now allow you to explicitly acknowledge messages as processed by committing the offsets, making the usage easier for anyone who is familiar with Apache Kafka. Unfortunately, this required a breaking change, so Topics in 21.06 are not backwards compatible with the implementation in older releases, and the rolling upgrade across Coherence versions is not supported.</p><p>For the complete list of bug fixes and improvements, please refer to the <a href="https://github.com/oracle/coherence/releases/tag/21.06">release notes on GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5181b47020d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/coherence-ce-21-06-released-d5181b47020d">Coherence CE 21.06 Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Micronaut Coherence 1.0.0 M2 Released]]></title>
            <link>https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-m2-released-c01976d4f619?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c01976d4f619</guid>
            <category><![CDATA[news]]></category>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[announcements]]></category>
            <category><![CDATA[micronaut]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Tue, 04 May 2021 01:59:15 GMT</pubDate>
            <atom:updated>2021-05-04T01:59:15.013Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce immediate availability of Micronaut Coherence 1.0.0-M2, the second milestone release on the road to the 1.0.0 release in June.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pPjlswWWDRB_2R8s.png" /></figure><p>Micronaut Coherence 1.0.0 M2 adds support for async repositories and persistence events, and depends on Coherence 21.06 M2, which was released last week.</p><p>This is on top of <a href="https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-milestone-1-released-fa1a3d850afb">all the features</a> that were released in March as part of M1 release.</p><p>You can run Micronaut services and Coherence cluster members in the same or different JVMs, access Coherence using Micronaut Data, use Micronaut Messaging to publish and consume messages stored in Coherence NamedTopics, and use Coherence as a back end data store for Micronaut Caching, Distributed Config, and HTTP Sessions.</p><p>The complete documentation for the currently supported features is available <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#introduction">here</a>.</p><p>At this point we are pretty much feature complete, and will likely only be polishing existing features for the final 1.0.0 release, based on user feedback. The final release should coincide with the release of Coherence CE 21.06 in June.</p><p>Enjoy!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c01976d4f619" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-m2-released-c01976d4f619">Micronaut Coherence 1.0.0 M2 Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coherence CE 21.06 Milestone 2 Released]]></title>
            <link>https://medium.com/oracle-coherence/coherence-ce-21-06-milestone-2-released-4467cc94f118?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/4467cc94f118</guid>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[announcements]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Thu, 29 Apr 2021 18:37:18 GMT</pubDate>
            <atom:updated>2021-04-29T18:40:50.150Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce immediate availability of Coherence 21.06-M2 release, the second milestone release on the road to Coherence 21.06 scheduled for June of this year, which contains a number of bug fixes and improvements, and a brand new <a href="https://coherence.community/21.06-M2/docs/#/docs/core/05_repository">Repository API</a> implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O8XsvbfcZhGW6w5m.png" /></figure><p>The Repository API implements <a href="https://martinfowler.com/eaaCatalog/repository.html">Repository pattern</a> and enables another way of accessing data stored in Coherence. It provides a higher-level API on top of the existing NamedMap API, effectively making many common data access operations one-liners. It is particularly well suited for applications that use Domain Driven Design (DDD), although it is certainly not limited only to those.</p><p>The Milestone 2 release adds support for asynchronous, CompletableFuture-based repository implementations, which allow you to access data managed by Coherence in a non-blocking fashion, as well as to stream potentially large result sets without incurring the cost of accumulating all the results in a single process.</p><p>The Repository API was introduced to make the implementation of data access layer within the applications easier, regardless of which framework you use to implement applications that use Coherence as a data store. It works equally well for plain Java applications and applications that use CDI, where you can simply create your own repository implementations, as described at the beginning of this document.</p><p>It is also the foundation for our <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#repository">Micronaut Data</a> repository implementations, so all the functionality described here is available when using those frameworks as well. The only difference is how you define your own repositories, which is framework-specific and documented separately.</p><p>We hope you’ll find this new feature useful, and that it will make implementation of your Coherence-backed data access layers even easier.For more information check out complete <a href="https://coherence.community/21.06-M2/docs/#/docs/core/05_repository">Repository API documentation</a>.</p><p>For the list of remaining bug fixes and improvements, please refer to the <a href="https://github.com/oracle/coherence/releases/tag/21.06-M2">release notes on GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4467cc94f118" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/coherence-ce-21-06-milestone-2-released-4467cc94f118">Coherence CE 21.06 Milestone 2 Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coherence CE 21.06 Milestone 1 Released]]></title>
            <link>https://medium.com/oracle-coherence/coherence-ce-21-06-milestone-1-released-2afe2a64a641?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2afe2a64a641</guid>
            <category><![CDATA[announcements]]></category>
            <category><![CDATA[releases]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[coherence]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 03:18:40 GMT</pubDate>
            <atom:updated>2021-04-02T03:18:40.925Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce immediate availability of Coherence 21.06-M1 release, the first milestone release on the road to Coherence 21.06 scheduled for June of this year, which contains a number of bug fixes and improvements, and a brand new <a href="https://coherence.community/21.06-M1/docs/#/docs/core/05_repository">Repository API</a> implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCBLDcBGr3tBfPZ3Mnh9tw.png" /></figure><p>The Repository API implements <a href="https://martinfowler.com/eaaCatalog/repository.html">Repository pattern</a> and enables another way of accessing data stored in Coherence. It provides a higher-level API on top of the existing NamedMap API, effectively making many common data access operations one-liners. It is particularly well suited for applications that use Domain Driven Design (DDD), although it is certainly not limited only to those.</p><p>The Repository API was introduced to make the implementation of data access layer within the applications easier, regardless of which framework you use to implement applications that use Coherence as a data store. It works equally well for plain Java applications and applications that use CDI, where you can simply create your own repository implementations, as described at the beginning of this document.</p><p>It is also the foundation for our <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#repository">Micronaut Data</a> repository implementations, so all the functionality described here is available when using those frameworks as well. The only difference is how you define your own repositories, which is framework-specific and documented separately.</p><p>We hope you’ll find this new feature useful, and that it will make implementation of your Coherence-backed data access layers even easier.For more information check out complete <a href="https://coherence.community/21.06-M1/docs/#/docs/core/05_repository">Repository API documentation</a>.</p><p>For the list of remaining bug fixes and improvements, please refer to the <a href="https://github.com/oracle/coherence/releases/tag/21.06-M1">release notes on GitHub</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2afe2a64a641" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/coherence-ce-21-06-milestone-1-released-2afe2a64a641">Coherence CE 21.06 Milestone 1 Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Micronaut Coherence 1.0.0 Milestone 1 Released]]></title>
            <link>https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-milestone-1-released-fa1a3d850afb?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa1a3d850afb</guid>
            <category><![CDATA[micronaut]]></category>
            <category><![CDATA[announcements]]></category>
            <category><![CDATA[integration]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[coherence]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Sun, 14 Mar 2021 21:02:48 GMT</pubDate>
            <atom:updated>2021-03-14T21:02:48.488Z</atom:updated>
            <content:encoded><![CDATA[<p>We are pleased to announce immediate availability of Micronaut Coherence 1.0.0-M1, the first milestone release on the road to the 1.0.0 release in June.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mE9nt6RCx9V-ZtOuxS9f4Q.png" /></figure><p>While only a preview release, it certainly packs a punch by providing support for a number of Micronaut features.</p><h4>Dependency Injection of Coherence-managed Objects</h4><p>A new micronaut-coherence module provides factories for commonly used Coherence objects, such as Cluster, Session, NamedMap, NamedCache, NamedTopic, and many others, which allows you to <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#injection">easily inject those objects</a> into your application classes.</p><h4>Listeners for Coherence Events</h4><p>The micronaut-coherence module also provides support for Coherence <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#coherenceEvents">server-</a> and <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#mapEvents">client-side</a> events via Micronaut event listeners.</p><h4>Micronaut Data Support</h4><p>The micronaut-coherence-data module alows you to use <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#repository">Micronaut Data with Coherence as a back end data store</a>.</p><h4>Micronaut Messaging Support</h4><p>Finally, the micronaut-coherence module provides support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#messagingWithTopics">Micronaut Messaging using Coherence Topics</a>.</p><h4>Micronaut Caching Support</h4><p>The micronaut-coherence-cache module adds support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#cache">using Coherence as a back end for Micronaut Cache</a>.</p><h4>Micronaut Distributed Config Support</h4><p>The micronaut-coherence-distributed-configuration module adds support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#distributedConfiguration">using Coherence as a store for Micronaut Distributed Configuration</a>.</p><h4>Micronaut HTTP Sessions Support</h4><p>The micronaut-coherence-session module adds support for <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#coherenceHttpSessions">using Coherence as a store for Micronaut HTTP Sessions</a>.</p><p>The goal for the Micronaut Coherence integration is to make development of Micronaut applications and microservices with a Coherence back end as simple as possible, and we believe we’ve made great strides towards it in this release.</p><p>To see how many of the features above work together, check out <a href="https://github.com/coherence-community/todo-list-example/tree/master/java/micronaut-server">Micronaut server implementation</a> of our <a href="https://github.com/coherence-community/todo-list-example">To Do List sample application</a>.</p><p>You can run Micronaut services and Coherence cluster members in the same or different JVMs, access Coherence using Micronaut Data, use Micronaut Messaging to publish and consume messages stored in Coherence NamedTopics, and use Coherence as a back end data store for Micronaut Caching, Distributed Config, and HTTP Sessions.</p><p>The complete documentation for the currently supported features is available <a href="https://micronaut-projects.github.io/micronaut-coherence/latest/guide/#introduction">here</a>.</p><p>We plan to add support for asynchronous and reactive Micronaut Data repositories, and polish some of the existing features that may be a bit “rough around the edges” at the moment for Milestone 2, which is tentatively planned for late April/early May.</p><p>The final release should coincide with the release of Coherence CE 21.06 later in June.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa1a3d850afb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/micronaut-coherence-1-0-0-milestone-1-released-fa1a3d850afb">Micronaut Coherence 1.0.0 Milestone 1 Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello Coherence, Part 3]]></title>
            <link>https://medium.com/oracle-coherence/hello-coherence-part-3-2670050925d?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2670050925d</guid>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[scalability]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[coherence]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Wed, 03 Feb 2021 23:57:57 GMT</pubDate>
            <atom:updated>2021-02-04T00:31:57.569Z</atom:updated>
            <content:encoded><![CDATA[<h4>Deploy Coherence application to a Kubernetes cluster, and then scale, monitor and manage that cluster</h4><p><em>This article was originally published in </em><a href="https://blogs.oracle.com/javamagazine/hello-coherence-community-edition-part-3-packaging-deployment-scaling-persistence-and-operations-with-java"><em>Java Magazine</em></a><em>, on January 15, 2021.</em></p><p>Oracle Coherence started as a distributed caching product and then evolved into an in-memory data grid. It’s an essential tool for improving the performance and scalability of Java applications, and it’s widely used for large-scale projects — think of it as a scalable, concurrent, fault-tolerant java.util.Map implementation that is partitioned across multiple JVMs, machines, and even data centers.</p><p>In the summer of 2020, Oracle released <a href="https://coherence.community/">Coherence Community Edition (CE)</a>, an open source version of the product.</p><p>In the <a href="https://medium.com/oracle-coherence/hello-coherence-part-1-6900de3f9ceb">first article in this series</a>, I implemented a REST API that allows you to manage a to-do list of tasks stored in Coherence. <a href="https://medium.com/oracle-coherence/hello-coherence-part-2-8d26d7840139">In the second article</a>, I built a React-based web front end and JavaFX-based desktop client.</p><p>In this part, I’ll complete the series by covering the packaging, deployment, and operational aspects of this project. That includes converting the existing demo into a production-quality application by adding support for scale out, persistence, monitoring, and end-to-end request tracing. <strong>Figure 1</strong> shows the UI for the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yu4gr0TJTXRp0il9WB4e2g.png" /><figcaption><strong>Figure 1.</strong> A user-friendly interface for the sample to-do list application</figcaption></figure><h3>Creating a Docker image</h3><p>To deploy the application to Kubernetes, first create a Docker image for it. Oracle provides prebuilt Docker images for the latest Coherence CE versions, which can be downloaded from the <a href="https://github.com/orgs/oracle/packages/container/package/coherence-ce">GitHub Docker Registry</a>. However, these images are primarily useful for testing and quick demos that require only the basic functionality and do not use any custom server-side code. For everything else, including the To-Do List application I’ve been working on, you need to create a custom Docker image.</p><p>It’s important to remember that Coherence is just a library and is embedded into your Java SE application or microservice the same way any of the popular lightweight frameworks such as Spring Boot, Micronaut, or Helidon are. In that way, Coherence’s data management services are similar to the embedded HTTP and gRPC services these lightweight application frameworks allow you to run. In other words, there is no separate server to run that your application then connects to: Your application <em>is</em> the Coherence cluster member.</p><p>While there are several ways to build a Docker image for a lightweight Java SE application and some frameworks, such as Spring Boot, even provide their own tooling for that purpose, the easiest way to build an image for a generic Java application I have used so far is the <a href="https://github.com/GoogleContainerTools/jib/tree/master/jib-maven-plugin">Jib Maven plugin</a>. It gets the job done by packaging all the necessary dependencies based on the contents of your POM file and doesn’t require that you write any Dockerfiles or startup scripts. The plugin also packages various types of dependencies (external and project) into different image layers, reducing image size and build time in the process. It is also a perfect fit for Helidon/Coherence CE applications, such as the one I’ve created, so that’s what I will use.</p><p>The first step is to configure the Jib plugin within the POM file. I will do this within a Maven profile that needs to be explicitly activated to build a Docker image only when I want to, not during each Maven build.</p><pre>&lt;profiles&gt;<br>  &lt;profile&gt;<br>    &lt;id&gt;docker&lt;/id&gt;<br>    &lt;build&gt;<br>      &lt;plugins&gt;<br>        &lt;plugin&gt;<br>          &lt;groupId&gt;com.google.cloud.tools&lt;/groupId&gt;<br>          &lt;artifactId&gt;jib-maven-plugin&lt;/artifactId&gt;<br>          &lt;version&gt;2.7.1&lt;/version&gt;<br>          &lt;configuration&gt;<br>            &lt;from&gt;<br>              &lt;image&gt;<br>                gcr.io/distroless/java:11<br>              &lt;/image&gt;<br>            &lt;/from&gt;<br>            &lt;to&gt;<br>              &lt;image&gt;${project.artifactId}&lt;/image&gt;<br>              &lt;tags&gt;<br>                &lt;tag&gt;${project.version}&lt;/tag&gt;<br>              &lt;/tags&gt;<br>            &lt;/to&gt;<br>            &lt;container&gt;<br>              &lt;ports&gt;<br>                &lt;port&gt;1408&lt;/port&gt;<br>                &lt;port&gt;7001&lt;/port&gt;<br>              &lt;/ports&gt;<br>            &lt;/container&gt;<br>            &lt;containerizingMode&gt;packaged&lt;/containerizingMode&gt;<br>          &lt;/configuration&gt;<br>          &lt;executions&gt;<br>            &lt;execution&gt;<br>              &lt;goals&gt;<br>                &lt;goal&gt;dockerBuild&lt;/goal&gt;<br>              &lt;/goals&gt;<br>              &lt;phase&gt;package&lt;/phase&gt;<br>            &lt;/execution&gt;<br>          &lt;/executions&gt;<br>        &lt;/plugin&gt;<br>      &lt;/plugins&gt;<br>    &lt;/build&gt;<br>  &lt;/profile&gt;<br>&lt;/profiles&gt;</pre><p>The configuration above uses the <a href="https://github.com/GoogleContainerTools/distroless/tree/master/java">“distroless” Java 11 image</a> as a base image and creates the image with the same name and version as the Maven build artifact (todo-list-server, in this case). The configuration also exposes ports 1408 (for gRPC) and 7001 (for REST endpoints the application uses).</p><p>Now that the Jib plugin is configured, building a Docker image locally is a simple two-step process. First, you need to build the application and install its artifacts into a local Maven repository by running the following command:</p><p>$ mvn clean install</p><p>Once that’s done, you can build the image by running this command:</p><p>$ mvn package -Pdocker</p><blockquote><strong>Important warning:</strong> Be sure you have the Docker daemon running locally; otherwise, the step above will fail.</blockquote><p>If everything goes well, you should see output similar to the following in your Maven logs:</p><pre>[INFO] --- jib-maven-plugin:2.7.1:dockerBuild (default) @ todo-list-server ---<br>[INFO]<br>[INFO] Containerizing application to Docker daemon as todo-list-server, todo-list-server:20.12...<br>[INFO] Using base image with digest: sha256:b25c7a4f771209c2899b6c8a24fda89612b5e55200ab14aa10428f60fd5ef1d1<br>[INFO]<br>[INFO] Container entrypoint set to [java, -cp, /app/classpath/*:/app/libs/*, io.helidon.microprofile.cdi.Main]<br>[INFO]<br>[INFO] Built image to Docker daemon as todo-list-server, todo-list-server:20.12</pre><p>You can also verify that the image has been created by executing this command:</p><p>$ docker images | grep todo-list-server</p><p>The output should look similar to the following:</p><p>todo-list-server 20.12 584a44a8539b 50 years ago 260MB<br>todo-list-server latest 584a44a8539b 50 years ago 260MB</p><p>If you plan to run the application in a remote Kubernetes cluster, you can now tag the images above accordingly and push them to a Docker repository that your Kubernetes cluster can access, using standard Docker tooling. If you only want to run the application in a local Kubernetes cluster, you should be all set.</p><p>You can test the Docker image by running it locally and accessing http://localhost:7001/, just like you did when running within an IDE or from the command line before, for example:</p><p>$ docker run -p 7001:7001 todo-list-server</p><p>You should see familiar log output in the terminal window and in the UI that you already know and love, and you should be able to create, edit, and complete some tasks.</p><h3>Deploying the application to Kubernetes</h3><p>By far the easiest (and recommended) way to deploy Coherence CE applications to Kubernetes is with <a href="https://oracle.github.io/coherence-operator/">Coherence Operator</a>, which is a Go-based application designed for this purpose.</p><p>Coherence Operator defines a custom resource definition (CRD) for Coherence deployments, which makes correct Coherence cluster configuration, scaling, and management in general significantly simpler.</p><p>For example, Coherence Operator will automatically configure a headless service that allows Coherence cluster members to discover one another, services for external endpoints that you want to expose, a readiness probe that checks whether a Coherence member is fully initialized and ready to accept requests, and many other things. In other words, if you need to run Coherence in Kubernetes, use Coherence Operator.</p><p>The easiest way to install Coherence Operator is with the <a href="https://helm.sh/">Helm package monitor for Kubernetes</a>.</p><p>The first step is to add the Coherence Helm repo to your local Helm configuration by running the following commands:</p><p>$ helm repo add coherence https://oracle.github.io/coherence-operator/charts<br>$ helm repo update</p><p>The next step, which will install Coherence Operator, depends on whether you are using Helm 2 or Helm 3. If you are using Helm 2, run the following command:</p><p>$ helm install --name coherence-operator coherence/coherence-operator</p><p>If you are using Helm 3, you can omit the — name flag, for example:</p><p>$ helm install coherence-operator coherence/coherence-operator</p><p>Once Coherence Operator is installed, you should see a message indicating that. You can also verify the installation by running the following command and making sure the output resembles what’s shown below:</p><pre>$ kubectl get deployments</pre><pre>NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE<br>coherence-operator-controller-manager   1/1     1            1           31d</pre><p>Once Coherence Operator is up and running, you are ready to deploy the To-Do List application. The first step is to create a <a href="https://en.wikipedia.org/wiki/YAML">YAML file</a> for the Coherence deployment, as follows:</p><pre>apiVersion: coherence.oracle.com/v1<br>kind: Coherence<br>metadata:<br>  name: todo-list<br>spec:<br>  replicas: 1<br>  image: todo-list-server:latest<br>  application:<br>    type: helidon<br>  jvm:<br>    memory:<br>      heapSize: 2g<br>  ports:<br>    - name: grpc<br>      port: 1408<br>    - name: http<br>      port: 7001<br>      serviceMonitor:<br>        enabled: true</pre><p>Here’s an explanation for the resource above:</p><ul><li>The values for the apiVersion and kind attributes reference a custom CRD that was installed by Coherence Operator and trigger the processing of the Coherence deployment resource above by Coherence Operator.</li><li>The metadata/name attribute is the only other required piece of information, and it is used as a Kubernetes identifier for this Coherence deployment. It is also used as the name of the Coherence cluster, unless it is overridden via the spec/cluster attribute.</li></ul><p>The other attributes within the spec element should be fairly self-explanatory:</p><ul><li>The replicas attribute defines the number of Coherence cluster members to start.</li><li>The image attribute tells Kubernetes to use the Docker image created earlier (and should be modified accordingly if you tagged the image and pushed it to a Docker repo).</li><li>The jvm/memory/heapSize attribute tells Coherence Operator to set the initial and maximum heap size for each cluster member to 2 GB.</li><li>The application/type attribute tells Coherence Operator that this is a Helidon application, which results in the default <a href="https://helidon.io/">Helidon main class</a> being used to start each cluster member, instead of the DefaultCacheServer class that would normally be used in a standalone Coherence deployment.</li><li>Finally, the resource exposes ports 1408 and 7001 to serve the gRPC and HTTP/REST endpoints, respectively, via Kubernetes services todo-list-grpc and todo-list-http, based on the default service naming convention of appending the port name to the Coherence deployment name, and the resource tells Prometheus to scrape the metrics from each cluster member over the HTTP port by enabling the service monitor.</li></ul><p>With Coherence Operator installed, and the content above available in the app.yaml file, you can now install the application by running this command:</p><p>$ kubectl apply -f java/server/src/main/k8s/app.yaml</p><p>coherence.coherence.oracle.com/todo-list created</p><p>Let’s check what was actually created by Coherence Operator based on the Coherence deployment resource above.</p><p>First, you can see the details about the Coherence deployment itself by running this command:</p><pre>$ kubectl get coherence</pre><pre>NAME        CLUSTER     ROLE        REPLICAS   READY   PHASE<br>todo-list   todo-list   todo-list   1          1       Ready</pre><p>The output shows that the deployment name, the cluster name, and the role have all defaulted to todo-list, and you have one ready member in the cluster. Let’s see what hides behind the Coherence deployment above by using this command:</p><pre>$ kubectl get all</pre><pre>NAME                          READY   STATUS    RESTARTS   AGE<br>pod/todo-list-0               1/1     Running   0          8m52s</pre><pre>NAME                      TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)<br>service/todo-list-grpc    ClusterIP   10.96.13.213   &lt;none&gt;        1408/TCP<br>service/todo-list-http    ClusterIP   10.96.89.213   &lt;none&gt;        7001/TCP<br>service/todo-list-sts     ClusterIP   None           &lt;none&gt;        7/TCP<br>service/todo-list-wka     ClusterIP   None           &lt;none&gt;        7/TCP</pre><pre>NAME                         READY   AGE<br>statefulset.apps/todo-list   1/1     8m52s</pre><p>As you can see, Coherence deployment is backed by a stateful set, which allows you to configure reliable persistent storage for cluster members, as you’ll do in a minute.</p><p>There are also four Kubernetes services that were created by Coherence Operator. The first two are what you would expect based on the deployment resource, and they enable access to gRPC and the HTTP endpoints provided by each cluster member. The other two are headless services that are automatically created by Coherence Operator to keep track of the stateful set members and a well-known addresses (WKA) list that allows new members to join the Coherence cluster. You can ignore the fact that they exist, at least for now.</p><h3>Scaling the Coherence cluster</h3><p>At the moment, the stateful set has only one pod within it, but that will change when you scale the cluster with this command:</p><p>$ kubectl scale coherence todo-list --replicas 10</p><p>coherence.coherence.oracle.com/todo-list scaled</p><p>It may take a minute or two for the additional nine members to start and join the cluster, but once everything is up and running you should be able to run the following commands and see similar output:</p><pre>$ kubectl get coherence</pre><pre>NAME        CLUSTER     ROLE        REPLICAS   READY   PHASE<br>todo-list   todo-list   todo-list   10         10      Ready</pre><pre>$ kubectl get all</pre><pre>NAME                          READY   STATUS    RESTARTS   AGE<br>pod/todo-list-0               1/1     Running   0          46m<br>pod/todo-list-1               1/1     Running   0          2m56s<br>pod/todo-list-2               1/1     Running   0          2m55s<br>pod/todo-list-3               1/1     Running   0          2m55s<br>pod/todo-list-4               1/1     Running   0          2m55s<br>pod/todo-list-5               1/1     Running   0          2m55s<br>pod/todo-list-6               1/1     Running   0          2m55s<br>pod/todo-list-7               1/1     Running   0          2m55s<br>pod/todo-list-8               1/1     Running   0          2m55s<br>pod/todo-list-9               1/1     Running   0          2m55s</pre><pre>NAME                         READY   AGE<br>statefulset.apps/todo-list   10/10   46m</pre><p>Yes: That’s what I mean when I say that Coherence allows you to scale <em>stateful </em>workloads just as easily as <em>stateless</em> workloads. Each one of the 10 pods above not only serves the incoming REST and gRPC requests but also stores approximately one-tenth of the data the application manages!</p><p>The best part is that I scaled to only 10 nodes to keep the output somewhat manageable. As long as I have enough capacity in the Kubernetes cluster I’m using, I can easily scale to 100, 500, or even 1,000 members. Keep in mind that Kubernetes limits the number of pods per node to 100, and you shouldn’t really push that limit. So you will need a fairly large Kubernetes cluster to run large Coherence clusters.</p><p>I can also scale up by making each member bigger. For example, by changing the member heap size from 2 GB to 20 GB, I can increase cluster storage capacity tenfold without changing the number of members.</p><p>You can play with the size of the cluster and the size of each member to balance your data storage and processing needs. The more members you have, the more JVMs your HTTP and gRPC requests will be load balanced across; at the same time, the bigger each member is, the more data it will be able to store.</p><p>However, it is important to understand the trade-offs as well. Larger clusters (based on the number of members) consume more resources, create more monitoring data to collect, and tend to be more difficult to manage.</p><p>At the same time, in a cluster that is too small (say 2 to 4 members, each holding a lot of data), failure of a single member can have a significant impact on the time it takes to fail over and rebalance the data across the remaining members. It is much more costly to fail over and rebalance one-third of the data set than one-thirtieth of the data set.</p><h3>Accessing the application</h3><p>Now that you have the application up and running, how can you access it? The simplest way, which is good enough for a quick test, is by using Kubernetes port forwarding to forward local ports to the HTTP and gRPC services you created, for example:</p><p>$ kubectl port-forward service/todo-list-http 7001:7001<br>$ kubectl port-forward service/todo-list-grpc 1408:1408</p><p>Each command above will block, so you need to run them in separate terminal windows or tabs. You can also run them in the background, but I do not recommend that because you won’t see the output. Also, keep in mind that Kubernetes has a habit of dropping forwarded connections quite frequently, so you may need to reconnect if that happens.</p><p>With the port forwards above in place, you should be able to access both the web front end and the gRPC endpoints from the JavaFX client via the same local endpoints you used before.</p><p>Obviously, port forwarding is <em>not</em> how you should run a production application. Instead, you would make the application available via an ingress controller, typically fronted by a load balancer.</p><p>How exactly you do that is outside the scope of this article. That said, assuming you have configured the Nginx ingress controller for your Kubernetes cluster, you should be able to create ingresses for both HTTP and gRPC endpoints using definitions similar to these:</p><pre>apiVersion: extensions/v1beta1<br>kind: Ingress<br>metadata:<br>  name: http-ingress<br>spec:<br>  rules:<br>  - host: tasks.seovic.com<br>    http:<br>      paths:<br>      - backend:<br>          serviceName: todo-list-http<br>          servicePort: 7001<br>---<br>apiVersion: extensions/v1beta1<br>kind: Ingress<br>metadata:<br>  name: grpc-ingress<br>  annotations:<br>    nginx.ingress.kubernetes.io/backend-protocol: &quot;GRPC&quot;<br>spec:<br>  rules:<br>  - host: grpc.tasks.seovic.com<br>    http:<br>      paths:<br>      - backend:<br>          serviceName: todo-list-grpc<br>          servicePort: 1408</pre><p>To complete the configuration, you would need to use the domain name that you own and create DNS “A” records for the hosts above that point to the load balancer in front of your ingress controller.</p><h3>Configuring data persistence across restarts</h3><p>You now have a cluster of 10 members up and running that is deployed across multiple VMs, machines, and possibly even availability zones or domains in the cloud. This allows the application to tolerate the failure of not only individual members but of a whole availability zone or domain. Why? Coherence will, by default, create backups as far from the primary copy of the data as possible. If the cluster is spread across availability zones A, B, and C, a backup for a primary copy owned by a member in zone A will be stored in zone B or C. This is completely automatic, as long as the Kubernetes zone metadata is configured correctly.</p><p>However, the application’s data is still stored only in memory, and it remains available only as long as the cluster is up and running. If you shut the whole cluster down, you will lose all the data, which is rarely, if ever, desirable — especially in a mission critical To Do List application, such as the example in this article.</p><p>To preserve data across cluster restarts, you have two options:</p><ul><li>Write data automatically to some kind of persistent datastore, such as a relational database or key-value store, and load data from it when necessary. This is certainly possible via the Coherence cache store mechanism, but it is less than ideal for this application because it requires setting up an external datastore. That negates some of the benefits and simplicity of the stateful application you created.</li><li>Enable Coherence persistence and configure the application to attach a persistent disk volume to each pod within the stateful set backing your deployment. This way Coherence itself will persist all the data to a disk volume that is managed by the cloud provider and will be reattached to the correct pod upon restart. This is the option that’s best for this project, and that’s what I’ll discuss next.</li></ul><p>To enable Coherence persistence and tell the cloud provider to attach some disk volumes to the stateful pods, add the coherence section below to the app.yaml file:</p><pre>spec:<br>  # insert before jvm section<br>  coherence:<br>    persistence:<br>      mode: active<br>      persistentVolumeClaim:<br>        storageClassName: &quot;oci-bv&quot;<br>        accessModes:<br>          - ReadWriteOnce<br>        resources:<br>          requests:<br>            storage: 50Gi</pre><p>This will configure Coherence to use the <em>active</em> persistence mode, instead of the default <em>on-demand</em> mode, which will cause it to write data to disk upon each modification. This also instructs Coherence Operator to provision a 50-GB persistent volume storage for each cluster member using the oci-bv (OCI Block Volume) storage class.</p><blockquote><strong>Note:</strong> I am running the application in <a href="https://www.oracle.com/cloud-native/container-engine-kubernetes/">Oracle Container Engine for Kubernetes</a>, which is why I specified oci-bv as a storage class. If you are using a different cloud provider, you should modify the storage class name accordingly.</blockquote><p>Persistence is one of the few features that impact the whole cluster and cannot be changed at runtime, so to apply the change above you will need to redeploy the application, as follows:</p><pre>$ kubectl delete -f java/server/src/main/k8s/app.yaml</pre><pre>coherence.coherence.oracle.com &quot;todo-list&quot; deleted</pre><pre>$ kubectl apply -f java/server/src/main/k8s/app.yaml</pre><pre>coherence.coherence.oracle.com/todo-list created</pre><p>Once everything is back up and running, you can check that a PersistentVolumeClaim (PVC) was created for the (only) cluster member, for example:</p><pre>$ kubectl get pvc</pre><pre>NAME                             STATUS   VOLUME  CAPACITY  STORAGECLASS<br>persistence-volume-todo-list-0   Bound    csi-…   50Gi      oci-bv</pre><p>Similarly, when you scale the cluster back to 10 members, each member should have a 50-GB PVC attached, as shown below:</p><pre>$ k scale coherence todo-list --replicas 10</pre><pre>coherence.coherence.oracle.com/todo-list scaled</pre><pre>$ kubectl get pvc</pre><pre>NAME                             STATUS   VOLUME  CAPACITY  STORAGECLASS<br>persistence-volume-todo-list-0   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-1   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-2   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-3   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-4   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-5   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-6   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-7   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-8   Bound    csi-…   50Gi      oci-bv<br>persistence-volume-todo-list-9   Bound    csi-…   50Gi      oci-bv</pre><p>You can verify that the PVC was mounted by the pod by running this command:</p><p>$ kubectl describe pod todo-list-0</p><p>Then, verify that you see the persistent volume mount within the “Mounts:” section</p><p>/coherence-operator/persistence from persistence-volume (rw)</p><p>and the corresponding volume definition within the “Volumes:” section</p><pre>persistence-volume:<br>    Type:       PersistentVolumeClaim<br>    ClaimName:  persistence-volume-todo-list-0<br>    ReadOnly:   false</pre><p>The easiest way to test if the persistence actually works as expected is to create some tasks, complete a few of them, and then scale the cluster down to zero members by using the following command:</p><p>$ k scale coherence todo-list --replicas 0</p><p>This will effectively shut all the members down and terminate all the pods within the Coherence deployment. Once you have verified that all the pods have been terminated, scale the cluster back to 10 members and refresh the UI (you may need to forward the port again, because the connection will likely be broken by the previous shutdown). All the data should be there, exactly the way you left it before shutting the cluster down.</p><p><em>By making a simple YAML change and enabling persistence, you now have a durable, stateful application that can be scaled to hundreds of JVMs, members, and pods just as easily as any stateless application.</em></p><h3>Configuring observability and tracing</h3><p>It’s great that you have the application up and running and that you can easily scale it out or up to support additional load, but this is still a complex, distributed system. You need to be able to observe what’s happening inside of it to address issues when they inevitably arise.</p><p>Coherence enables observability via several mechanisms:</p><ul><li>Monitoring metrics, exposed via Java Management Extensions and an OpenMetrics-compliant HTTP endpoint that can be consumed by tools such as Prometheus</li><li>Built-in Grafana dashboards that can be used to visualize those metrics</li><li>Tracing information via <a href="https://opentracing.io/">OpenTracing</a> that allows you to better understand the flow of individual requests through the system, which can help you understand and fix performance bottlenecks</li></ul><p>I will cover the first two topics in a bit, but for now I’ll focus on the third one: tracing.</p><p>My colleague on the Oracle Coherence core development team, Ryan Lubke, who implemented most of the OpenTracing support in Coherence, has written a <a href="https://medium.com/oracle-coherence/peek-inside-coherence-with-opentracing-dcdd6906dec8">nice series of articles</a> that describe how OpenTracing works and how it integrates with other technologies. You should read those articles, but I’ll try to summarize the important bits in the context of a Helidon application, which makes a number of things a bit simpler.</p><p>Both Helidon and Coherence support OpenTracing out of the box. All you have to do to enable it is to make a few minor changes to your application.</p><p>First, specify the name of the service that you want to publish tracing information for. This is easily accomplished by adding the following line to the META-INF/microprofile-config.properties file within the server project:</p><p>service.name=Tasks</p><p>You also need to add a dependency on the OpenTracing library you want to use. Helidon supports both <a href="https://zipkin.io/">Zipkin</a> and <a href="https://www.jaegertracing.io/">Jaeger</a>, and for this application, I’ve chosen the latter. To enable it, add a single dependency to the POM file, as follows:</p><pre>&lt;dependency&gt;<br>  &lt;groupId&gt;io.helidon.tracing&lt;/groupId&gt;<br>  &lt;artifactId&gt;helidon-tracing-jaeger&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>That’s really all there is to it as far as the application is concerned. The two minor changes above will cause the Helidon application to trace each REST request, all the way through Coherence, which will simply add its own spans to an existing trace started by Helidon.</p><p>With the changes above in place, you can rebuild the application and repackage it into a Docker image, but before you can deploy it, the following are a few additional changes you need to make for the Kubernetes deployment resource:</p><pre>spec:<br>  # insert before &#39;application&#39; section<br>  env:<br>    - name: TRACING_HOST<br>      value: &quot;jaeger-collector&quot;<br>    - name: JAEGER_SAMPLER_TYPE<br>      value: &quot;const&quot;<br>    - name: JAEGER_SAMPLER_PARAM<br>      value: &quot;1&quot;</pre><p>The first environment variable, TRACING_HOST, is actually the only one that is required, and it tells the Jaeger client where to publish tracing information.</p><p>The other two variables are there to change the default Jaeger client behavior and publish tracing information for every single request, instead of only for a small sample of the requests. It’s not something you would do in production, but it is certainly handy when you want to demonstrate tracing support in an application.</p><p>The last thing you need is to make sure you have a Jaeger instance up and running that you can publish tracing information to. Setting up Jaeger is outside the scope of this article, but you can <a href="https://www.jaegertracing.io/docs/1.21/operator/">follow these instructions</a> to install Jaeger Operator into your Kubernetes cluster. Once that’s done, create a Jaeger instance for the application, which can be as simple as running this command:</p><p>$ kubectl apply -f java/server/src/main/k8s/jaeger.yaml</p><p>If you are using an ingress controller, you will also need to configure the ingress for the jaeger-query service, similar to the following:</p><pre>apiVersion: extensions/v1beta1<br>kind: Ingress<br>metadata:<br>  name: jaeger-ingress<br>spec:<br>  rules:<br>  - host: jaeger.seovic.com<br>    http:<br>      paths:<br>      - backend:<br>          serviceName: jaeger-query<br>          servicePort: 16686</pre><p>With Jaeger up and running and the latest version of the application deployed, you can create, complete, and delete some tasks and use the Jaeger UI to see what’s happening under the hood.</p><p>For example, the trace (see <strong>Figure 2</strong>) for one of the GET /api/tasks requests clearly shows that the ToDoResource.getTasks JAX-RS method was invoked, which then executed a query against all 10 Coherence members in parallel to retrieve a list of tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDJujhxwNwr3iXtoKMjRTQ.png" /><figcaption><strong>Figure 2.</strong> Querying for all tasks</figcaption></figure><p>In <strong>Figure 3</strong>, you can see that when a new task is created via the POST /api/tasksrequest, the ToDoResource.createTask method is called, which performs a Putrequest against a primary owner for the newly created Task, which then writes it to a backup member and the persistent store (disk) in parallel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15M4LUvZKC0EJ2m5jUimYQ.png" /><figcaption><strong>Figure 3.</strong> Creating a task</figcaption></figure><p>You can see a similar trace (<strong>Figure 4</strong>) when updating the task via the PUT /api/tasks/:id request. The ToDoResource.updateTask method is called, which then uses an entry processor to update the task on the primary member or owner. The primary member then updates the backup and the persistent store in parallel, just as in the case of the Put request.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDS1g5t-LRGxfixn7Vkogg.png" /><figcaption><strong>Figure 4.</strong> Updating a task</figcaption></figure><p>I’m sure you’ll agree that having this level of visibility, from the REST API endpoint all the way to the disk write deep in the guts of Coherence, across potentially many cluster members executing code sequentially or in parallel, can greatly simplify troubleshooting performance issues. It can also help you visualize what’s going on in a complex, distributed system and allow you to verify that what you expect to be happening is <em>actually</em> happening.</p><p>I’m personally not familiar with any other product that provides this level of visibility into the inner workings.</p><h3>Monitoring with Prometheus and Grafana</h3><p>Tracing is great for understanding the flow of the requests through the system and pinpointing where performance bottlenecks are, but it certainly doesn’t provide the full picture. For example, there is no way to see how much data is in various caches or maps, what the overall health of individual cluster members and services is, the rate of requests or data growth, and many other things you might need to determine to truly understand the health of the system as a whole and to be able to make scaling decisions and other decisions to make the system perform well over time.</p><p>Doing all that requires you to capture a number of point-in-time metrics periodically and analyze them over time, which is exactly what time-series databases such as <a href="https://prometheus.io/">Prometheus</a> and monitoring dashboards such as <a href="https://grafana.com/">Grafana</a> are designed for. Setting up Prometheus and Grafana is far beyond the scope of this article, but there are plenty of resources on the web that will help you configure both using <a href="https://github.com/prometheus-operator/prometheus-operator/blob/master/Documentation/user-guides/getting-started.md">Prometheus Operator</a>. Make sure you enable the Prometheus ServiceMonitor, since that’s what Coherence uses to configure Prometheus to scrape the /metrics endpoint on each Coherence cluster member.</p><blockquote><strong>Important note:</strong> If you don’t have Prometheus up and running before deploying the application, you may need to delete and redeploy the application for Prometheus to start scraping metrics from Coherence members.</blockquote><p>You should also follow <a href="https://oracle.github.io/coherence-operator/docs/3.1.1/#/metrics/030_importing">the instructions in the Coherence Operator documentation</a> for how to import Coherence monitoring dashboards into Grafana.</p><p>Once you have everything up and running, you should see something similar to <strong>Figure 5</strong> when you log in to Grafana and open the main Coherence dashboard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9CrJDSyOBxsBPx_3Lo2Ig.png" /><figcaption><strong>Figure 5.</strong> Grafana’s cluster overview dashboard</figcaption></figure><p>This dashboard allows you to see, at a glance, the total number of cluster members, heap utilization for the cluster as a whole and per member role, and member load averages, as well as how many members have recently left the cluster and whether there are any endangered services (that is, services without backups).</p><p>If you click the Cluster Members box, the Member Summary dashboard will open, and you can then look at individual member dashboards by clicking a member’s name. For example, the Member Details dashboard for the todo-list-0 member looks like <strong>Figure 6</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l25Ku0DlIckKaaLKFs6IdA.png" /><figcaption><strong>Figure 6.</strong> The Member Details dashboard for todo-list-0</figcaption></figure><p>On the Member Details dashboard, you can see heap utilization, thread utilization and garbage collection information for that member, as well as publisher and receiver success rates, which indicate the quality of the network between this and other members; the closer the number is to 100%, the better.</p><p>On the Services Summary dashboard, shown in <strong>Figure 7</strong>, you can see the status of each Coherence service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xEyPCZjDaRrRLBZ8RU_rg.png" /><figcaption><strong>Figure 7.</strong> The Service Summary dashboard</figcaption></figure><p>In <strong>Figure 7</strong>, the application service I care most about, todo-listService, runs on all 10 members and is in the MACHINE-SAFE state, meaning it could tolerate the loss of any of the six virtual machines in the Kubernetes cluster without losing any data. You can also see when the load was the highest by looking at the distribution of task executions over time.</p><p>Clicking the todo-listService link brings up the Service Details dashboard for that service, as shown in <strong>Figure 8</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Rsa0H-g--2kXWsaMMin0w.png" /><figcaption><strong>Figure 8.</strong> The Service Details dashboard</figcaption></figure><p>You can see average task and request times for the service per member, as well as thread utilization information and the task rate and backlog per member.</p><p>The Cache Details dashboard (<strong>Figure 9</strong>) shows the total number of tasks you are managing, the amount of memory those tasks consume, and the size of indexes (if there are any). You can also see query duration information, how much memory was consumed by this cache over time, and how the entries are distributed and accessed across cluster members.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TxoZIrU22XIrBL3ynQh9Aw.png" /><figcaption><strong>Figure 9.</strong> The Cache Details dashboard</figcaption></figure><p>Finally, on the Persistence Summary dashboard (<strong>Figure 10</strong>), you can see how much disk space is consumed by the data the application is managing and how much disk space is still available:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEXHfB2F53GcGHnXxcjnPg.png" /><figcaption><strong>Figure 10.</strong> The Persistence Summary dashboard</figcaption></figure><p>These are not all the dashboards provided by Coherence, but they are the most useful ones for this particular application and will likely be useful in almost any application, so they are worth becoming familiar with.</p><p>As you can see, these tools provide lots of useful information out of the box, and they can be customized as necessary to provide exactly the information you care about.</p><h3>Conclusion</h3><p>This article completes the series and, truth be told, it’s a bit longer than I expected it to be and covers a lot of ground. The same is true for the whole series, which was originally supposed to be a single article. [Whoops! — <em>Ed.</em>]</p><p>I hope you enjoyed seeing how Oracle Coherence can help you build stateful services and applications that are resilient and easy to scale. Feel free to use the code for the sample application as a guide when implementing your own applications, and if you have any questions please reach out to me directly, or use one of the official Coherence social media channels, all of which you can find on the <a href="https://coherence.community/">Coherence CE website</a>.</p><p>I will leave you with <strong>Figure 11</strong> as an idea of where you can go with Coherence CE:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dz16XCmBoFdEToZ61bwCbw.png" /><figcaption><strong>Figure 11.</strong> A 1,000-member Coherence cluster</figcaption></figure><p>Not bad… I believe we are finally at the point where the cluster is large enough for my wife to enter all the tasks from her “Honey Do” list. ;-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2670050925d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/hello-coherence-part-3-2670050925d">Hello Coherence, Part 3</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Coherence Client for .NET Core Released]]></title>
            <link>https://medium.com/oracle-coherence/coherence-client-for-net-core-released-36341b018a02?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/36341b018a02</guid>
            <category><![CDATA[news]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[announcements]]></category>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Mon, 23 Nov 2020 22:45:52 GMT</pubDate>
            <atom:updated>2020-11-23T22:45:52.144Z</atom:updated>
            <content:encoded><![CDATA[<h3>Coherence Client for .NET Core Released</h3><p>We are pleased to announce that Coherence Client for .NET Core 3.1 and .NET Standard 2.0 has been released, and is available for <a href="https://www.nuget.org/packages/Coherence.Core/14.1.1.3">download from NuGet.org</a>.</p><p>This allows .NET Core applications to access data managed in Coherence from Windows, Linux and OS X.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*7ij78HBFdticR3mreUquWg.png" /></figure><p>Apart from the assembly name, which is nowCoherence.Core, this client is API-compatible with the existing Coherence Client for .NET Framework 4.0 (or newer), which should make transition from .NET Framework to .NET Core as simple as changing the assembly reference and recompiling the application against .NET Core SDK.</p><p>Some of the features that are .NET Framework-specific, such as legacy ASP.NET session store support, as well as support for Windows Forms and WPF, have been removed from this release.</p><h3>What’s Next?</h3><p>While we are very glad that Coherence users now have a way to access Coherence from .NET Core applications running on platforms other than Windows, this is by no means our only goal when it comes to .NET support.</p><p>We are currently working on the next generation .NET client for Coherence, which will support both Coherence*Extend and our new, gRPC-based transport layer, and will add a number of features that have been requested by the users, such as:</p><ul><li>Support for generics throughout the API</li><li>LINQ and Entity Framework support</li><li>ASP.NET Core support</li></ul><p>We are still in the very early stages, so it will take some time until that new .NET client is generally available, but you can follow our progress on <a href="https://github.com/oracle/coherence-dotnet-extend-client">GitHub</a> (make sure to “star” and/or “watch” the project to be notified when the milestone releases are published), and influence our direction by <a href="https://github.com/oracle/coherence-dotnet-extend-client/issues">requesting the features</a> that you feel are missing and would be nice additions to Coherence Client for .NET.</p><p>In the meantime, give our .NET Core client a try and let us know if you run into any problems by <a href="https://github.com/oracle/coherence-dotnet-extend-client/issues">reporting bugs</a> on GitHub.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36341b018a02" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/coherence-client-for-net-core-released-36341b018a02">Coherence Client for .NET Core Released</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello Coherence, Part 2]]></title>
            <link>https://medium.com/oracle-coherence/hello-coherence-part-2-8d26d7840139?source=rss-48d954472abc------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d26d7840139</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coherence]]></category>
            <category><![CDATA[javafx]]></category>
            <category><![CDATA[introduction]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Aleks Seovic]]></dc:creator>
            <pubDate>Mon, 02 Nov 2020 22:02:05 GMT</pubDate>
            <atom:updated>2020-11-02T22:13:38.515Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to develop React and JavaFX front-end clients that can work with a Coherence back-end application we created earlier</h4><p><em>This article was originally published in </em><a href="https://blogs.oracle.com/javamagazine/hello-coherence-community-edition-part-2-building-the-client"><em>Java Magazine</em></a><em>, on October 9, 2020.</em></p><p>In the <a href="https://medium.com/oracle-coherence/hello-coherence-part-1-6900de3f9ceb">first article in this series</a>, I showed how to implement a REST API that manages to-do list tasks stored in Coherence . We have tested it using curl and know that it works, but let’s face it — curl is not the most user friendly interface on the planet, and if we want our application to take the world by storm we need to do better than that.</p><p>This article will build on the back-end code from the previous article by implementing two clients: a React-based web UI (see <strong>Figure 1</strong>) and a desktop UI that uses JavaFX.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3l50cDu4ucITQHO0.png" /><figcaption><strong>Figure 1.</strong> A user-friendly interface for the To Do List application</figcaption></figure><h3>Client applications and Coherence</h3><p>First, let’s cover a fundamental topic: how do client applications connect to Coherence and access data?</p><p>Coherence supports two types of clients: cluster member clients and remote clients.</p><p>The REST API implemented in the previous article is an example of a <strong>cluster member client</strong>, which can be either <em>storage enabled</em> or <em>storage disabled</em>. Those types of members are essentially identical, except storage-disabled members do not store any data locally.</p><p>This is what I alluded to in the last article when I mentioned that this project <em>could </em>separate the data store and the app server: I could’ve run Helidon web servers that serve the REST API as storage-disabled members, separate from the storage-enabled members that manage all the data. Sometimes that makes sense, because it provides better isolation between the two and it allows them to scale independently. For simplicity I’ve decided not to do that, at least for now.</p><p>The benefit of using cluster member clients is that they are fully aware of the cluster topology and partition assignment. This allows the clients to directly access any data object stored in Coherence, via a single network hop. The downside is that these clients need to be on the same high-speed, low-latency network as the rest of the cluster, and they have the potential to destabilize the whole cluster if they start acting out and become unresponsive.</p><p><strong>Remote clients</strong>, on the other hand, work a bit differently. They do not connect directly to all other cluster members but to a proxy server that is typically a storage-disabled member of a cluster.</p><p>Traditionally, Coherence supported two types of proxies: Coherence*Extend and the Coherence REST proxy. Now there is also a third type: Coherence gRPC.</p><p><strong>Coherence*Extend </strong>is a proprietary, TCP-based RPC protocol that is used by Oracle’s existing Java, .NET, and C++ client implementations. Coherence*Extend has been around for a long time (since 2006), it is supported by many Oracle Coherence versions in a backward- and forward-compatible manner, and it has been proven in many mission-critical applications. On the other hand, Coherence*Extend is proprietary and synchronous, it doesn’t always play nicely with modern cloud deployments, and some of the clients implemented on top of it (.NET clients, in particular) are a bit old and do not use many of the latest features of the languages they support.</p><p><strong>Coherence REST </strong>is an implementation of a generic REST API that allows you to access from pretty much any platform or language data that is managed in Coherence. Unfortunately, it also comes with certain limitations due to the nature of REST and the underlying HTTP protocol itself, it is not as full-featured as native clients, and it can be a bit cumbersome to configure.</p><p>Quite frankly, while the REST proxy had its purpose at a time, I really don’t see much need or use for it any longer. It’s just as easy, if not easier, to implement your own application-specific REST API that is free to use a full Java API, as in the previous article, and expose it either via Helidon integration (recommended) or via the built-in HTTP server.</p><p><strong>Coherence gRPC</strong> is a third proxy implementation, introduced in the latest <a href="https://github.com/oracle/coherence/releases/tag/20.06">Coherence CE 20.06</a> release.</p><p>Coherence gRPC is a proxy implementation that uses <a href="https://grpc.io/">gRPC</a> as a transport and is a viable alternative to Coherence*Extend. This proxy builds on top of <a href="https://helidon.io/docs/v2/#/mp/grpc/01_mp_server_side_services">Helidon gRPC Server</a>, and it provides a number of immediate benefits: It works much better with modern cloud deployments, it is supported by various HTTP load balancers and Kubernetes ingress controllers, it is asynchronous, and the gRPC itself is supported by pretty much every relevant platform and language.</p><p>At the moment, Oracle offers only a native Java client for Coherence gRPC, which is what I’ll use to implement a JavaFX client in a bit, but with luck there will be a native Node.js/JavaScript client out soon, followed by modern .NET and C++ clients as well as new Python, Golang, and Swift clients.</p><p>And if you want a client for another platform that is not officially supported, you will be able to write it yourself. The Protobuf definitions for the services and messages Coherence supports are already publicly available, and you will be able to use existing client implementations as a guide when implementing your own.</p><p>The benefits of remote clients are that they don’t have to be on the same network, you can have as many of them as you need, they can come and go as they please without impacting cluster membership, and they can obviously be written in languages other than Java. The downside is that every request from the client has to go through the proxy, which adds an additional network hop and associated latency to each operation.</p><p>With that out of the way, it’s time to implement the clients.</p><h3>Implementing a React client</h3><p>As I admitted in the previous article, I am not really a front-end developer, and the choice of React is somewhat accidental and mostly driven by what I’m (barely) familiar with. You could easily implement a similar front end using Angular, Vue.js, or any other popular front-end framework.</p><blockquote>As a matter of fact, my colleague Tim Middleton has already implemented another web front end using <a href="https://www.oracle.com/webfolder/technetwork/jet/index.html">Oracle JavaScript Extension Toolkit (Oracle JET)</a>, which uses the same idea of the UI binding to a data model that is updated via events. If you are interested in it, the source code for the Oracle JET client is available on <a href="https://github.com/coherence-community/todo-list-example/tree/master/java/server/src/main/web/jet">GitHub</a>.</blockquote><p>All of these frameworks have one thing in common: They allow you to use the standard Node.js development toolchain to build and test the UI, and once you are satisfied you can “compile” the application into a set of static HTML, JavaScript, and CSS files that can be served by <em>any</em> web server capable of serving static content.</p><p>Therefore, a sample application can use the same Helidon Web Server that serves the REST API to serve the static front end as well. This approach simplifies the application quite a bit; there is no separate server to deploy and manage, and there are no cross-origin resource sharing (CORS) issues to deal with, because both the front end and the REST API have the same origin.</p><h3>Setting up the React client</h3><p>To build the React client, I need to answer a few questions:</p><ul><li>Where is the source for the front end going to be?</li><li>How will I build the front end as part of the existing Maven build?</li><li>How will the “compiled” front end be packaged in order to make it available for Helidon to serve?</li></ul><p>I’ll answer these questions in reverse order.</p><p>Helidon can serve static content either from the file system or from the classpath. The latter is much easier to manage, so I’ll package all the static files for the front end within the server JAR file and configure Helidon to serve the content from there by adding the META-INF/microprofile-config.properties file to the project:</p><pre>server.static.classpath.location=/web<br>server.static.classpath.welcome=index.html</pre><p>That’s really all there is to it — Helidon has now been told to serve static content from the web directory in the classpath and to use index.html as a default welcome file.</p><p>How will I build the front end as part of the Maven build to ensure that the static content for the front end ends up where Helidon expects it? To do this, I’ll use <a href="https://github.com/aseovic/npm-maven-plugin">npm-maven-plugin</a> by yours truly, which embeds an npm-based build into a Maven build:</p><pre>&lt;plugin&gt;<br>  &lt;groupId&gt;com.seovic.maven.plugins&lt;/groupId&gt;<br>  &lt;artifactId&gt;npm-maven-plugin&lt;/artifactId&gt;<br>  &lt;version&gt;1.0.4&lt;/version&gt;<br>  &lt;executions&gt;<br>    &lt;execution&gt;<br>      &lt;id&gt;build-frontend&lt;/id&gt;<br>      &lt;goals&gt;<br>        &lt;goal&gt;run&lt;/goal&gt;<br>      &lt;/goals&gt;<br>      &lt;phase&gt;generate-resources&lt;/phase&gt;<br>      &lt;configuration&gt;<br>        &lt;workingDir&gt;${project.basedir}/src/main/web&lt;/workingDir&gt;<br>        &lt;script&gt;build&lt;/script&gt;<br>      &lt;/configuration&gt;<br>    &lt;/execution&gt;<br>  &lt;/executions&gt;<br>&lt;/plugin&gt;</pre><p>The code above will run the build script defined in package.json during the generate-resources phase of the Maven build, and it says the source code for the front end will be under the src/main/web directory within the server project. See <strong>Figure 2</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/0*yJqosh4Lodt-ADhV.png" /><figcaption><strong>Figure 2.</strong> Front-end application within the larger Maven project</figcaption></figure><p>Note that the front-end application (and its developers) are completely unaware of the surrounding Maven structure. As far as they are concerned, the web directory highlighted above is the root of their JavaScript project.</p><p>Although that makes it easier for the front-end developers to do their job without having to learn Maven, it does mean that after the front end is built, it’s necessary to copy generated static files into the structure Maven understands. Fortunately, this is trivial to do using the standard maven-resources-plugin:</p><pre>&lt;plugin&gt;<br>  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;<br>  &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;<br>  &lt;version&gt;3.1.0&lt;/version&gt;<br>  &lt;executions&gt;<br>    &lt;execution&gt;<br>      &lt;id&gt;copy-frontend&lt;/id&gt;<br>      &lt;phase&gt;generate-resources&lt;/phase&gt;<br>      &lt;goals&gt;<br>        &lt;goal&gt;copy-resources&lt;/goal&gt;<br>      &lt;/goals&gt;<br>      &lt;configuration&gt;<br>        &lt;outputDirectory&gt;<br>           ${project.build.directory}/classes/web<br>        &lt;/outputDirectory&gt;<br>        &lt;resources&gt;<br>          &lt;resource&gt;<br>            &lt;directory&gt;<br>              ${project.basedir}/src/main/web/build<br>            &lt;/directory&gt;<br>            &lt;filtering&gt;true&lt;/filtering&gt;<br>          &lt;/resource&gt;<br>        &lt;/resources&gt;<br>      &lt;/configuration&gt;<br>    &lt;/execution&gt;<br>  &lt;/executions&gt;<br>&lt;/plugin&gt;</pre><p>That’s it. Now that the project structure is in place, it is time to proceed with the implementation.</p><h3>Implementing the React client</h3><p>Covering the complete front-end implementation is out of the scope of this article, because most of the UI-related code has nothing to do with Coherence and would quickly turn this article into a book chapter. The code is available on GitHub, along with the rest of the application, so feel free to clone the repository and check out the details if you are so inclined.</p><p>Here, the focus is on the state management aspect of the client application and on the interaction between the front-end app and the back-end REST API created in the previous article.</p><p>I will use <a href="https://redux.js.org/">Redux</a> to manage state locally on the client. It’s not the only option, but it does fit nicely into the event-driven architecture this application will implement. Redux uses <em>actions</em> that are <em>dispatched</em> to a <em>reducer</em> to update application <em>state</em>. Technically, Redux doesn’t really update anything, because it treats state as immutable; rather, it creates a new state based on the existing state and the action received.</p><p>If this is all a bit unclear (I know it took me a while to grok it), look at the reducer for the client-side representation of a to-do list. With luck, that should make things a bit clearer.</p><pre>export default function todos(state = [], action = null) {<br>  switch (action.type) {<br>    case INIT_TODOS:<br>      return action.todos || [];</pre><pre>    case ADD_TODO:<br>      return [<br>        {<br>          id: action.id,<br>          createdAt: action.createdAt,<br>          completed: false,<br>          description: action.description<br>        },<br>        ...state<br>      ];</pre><pre>    case DELETE_TODO:<br>      return state.filter(todo =&gt;<br>        todo.id !== action.id<br>      );</pre><pre>    case UPDATE_TODO:<br>      return state.map(todo =&gt;<br>        todo.id === action.id ?<br>          { ...todo, description: action.description } :<br>          todo<br>      );</pre><pre>    case COMPLETE_TODO:<br>      return state.map(todo =&gt;<br>        todo.id === action.id ?<br>          { ...todo, completed: action.completed } :<br>          todo<br>      );</pre><pre>    default:<br>      return state;<br>  }<br>}</pre><p>The function above defines a <em>reducer</em> for the state of the to-do list. Each case within the switch statement handles a different <em>action type</em> and returns a new state based on the current state and the <em>action payload</em> received. Whenever the state changes, the UI <em>reacts</em> to it (there is a reason the framework is called <em>React</em>) by refreshing itself accordingly.</p><p>What’s important to understand is that this state is local to the front-end app and at this point, it has nothing to do with the state being managed within the Coherence back end. To fix that and link the two together, it is necessary to do the following:</p><ul><li>Initialize the local state when the application is loaded</li><li>Update the local state based on the events received from the server</li></ul><p>Here’s the code to accomplish both of those tasks within the main App.jscomponent of the React application:</p><pre>let initialized = false;</pre><pre>function init(actions) {<br>    actions.fetchAllTodos();</pre><pre>    // register for server-side events<br>    let source = new EventSource(&#39;/api/tasks/events&#39;);</pre><pre>    source.addEventListener(&quot;insert&quot;, (e) =&gt; {<br>      let todo = JSON.parse(e.data);<br>      actions.addTodo(todo.id, todo.createdAt, todo.description);<br>    });</pre><pre>    source.addEventListener(&quot;update&quot;, (e) =&gt; {<br>      let todo = JSON.parse(e.data);<br>      actions.updateTodo(todo.id, todo.description, todo.completed);<br>    });</pre><pre>    source.addEventListener(&quot;delete&quot;, (e) =&gt; {<br>      let todo = JSON.parse(e.data);<br>      actions.deleteTodo(todo.id);<br>    });</pre><pre>    source.addEventListener(&quot;end&quot;, (e) =&gt; {<br>      console.log(&quot;end&quot;);<br>      source.close();<br>    });</pre><pre>    initialized = true;<br>}</pre><pre>const App = ({todos, actions}) =&gt; {<br>    if (!initialized) {<br>      init(actions);<br>    }</pre><pre>    return (<br>        &lt;div&gt;<br>        &lt;Header /&gt;<br>        &lt;TodoInput addTodo={actions.addTodoRequest}/&gt;<br>        &lt;MainSection todos={todos} actions={actions}/&gt;<br>        &lt;/div&gt;<br>    )<br>};</pre><p>The init function above addresses both of those tasks. First it calls the fetchAllTodos action, which makes the call to the REST API and dispatches the results to the reducer:</p><pre>export const initTodos = (todos) =&gt; ({type: types.INIT_TODOS, todos});</pre><pre>export function fetchAllTodos() {<br>  return (dispatch) =&gt; {<br>    request<br>      .get(&#39;/api/tasks&#39;)<br>      .end(function (err, res) {<br>        console.log(err, res);<br>        if (!err) {<br>          dispatch(initTodos(res.body));<br>        }<br>      });<br>  }<br>}</pre><p>Next, it registers an event source with the /api/tasks/events endpoint implemented on the server and handles each event by dispatching it to the Redux reducer.</p><p>The actions themselves are divided into two groups: the ones that update local, Redux-managed state and the ones that make remote calls to the REST API to update the server-side state in Coherence.</p><p>The remaining local actions are similar to the initTodos action above and simply add the appropriate action type to the payload, so they can be applied by the reducer. For example, the addTodo action is defined as follows:</p><pre>export const addTodo = (id, createdAt, description) =&gt; <br>               ({type: types.ADD_TODO, id, createdAt, description});</pre><p>The remote actions, on the other hand, simply make REST calls to the server without updating the Redux state directly. Instead, they rely on the event listeners registered earlier to apply any server-side state changes to the local state.</p><p>For example, the addTodoRequest action that is passed to the TodoInputcomponent above simply sends the request and logs the response:</p><pre>export function addTodoRequest(text) {<br>  return (dispatch) =&gt; {<br>    request<br>      .post(&#39;/api/tasks&#39;)<br>      .send({description: text})<br>      .end(function (err, res) {<br>        console.log(err, res);<br>      });<br>  }<br>}</pre><p>The actual task, in JSON format, is then received and added to the Redux state by the insert event handler defined earlier:</p><pre>source.addEventListener(&quot;insert&quot;, (e) =&gt; {<br>  let todo = JSON.parse(e.data);<br>  actions.addTodo(todo.id, todo.createdAt, todo.description);<br>});</pre><p>This reactive, event-driven approach has two important consequences:</p><ul><li>It makes it easier to implement the actions that mutate the server-side state, because you have to worry only about sending the request to the server. You don’t need to worry about synchronization of the server-side and client-side state.</li><li>It makes the client UI react to the server-side state changes, <em>regardless of which client made the change</em>.</li></ul><p>It should be obvious by now that this event-driven approach enabled by Coherence is significantly more efficient than what you would be able to implement with a majority of popular data stores, where you would likely have to rely on polling on the server or, worse, on the client to keep the UI up to date.</p><p>This concludes the React front-end implementation. Next, I’ll implement the JavaFX client.</p><h3>Implementing a JavaFX client</h3><p>To a large extent, the JavaFX client (see <strong>Figure 3</strong>) is very similar to the server-side REST API implementation from the previous article. It uses the same NamedMap API, it observes Coherence events, and many of the data access methods are exactly the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*9N9NV3Md5QiH1eHX.png" /><figcaption><strong>Figure 3.</strong> The JavaFX client</figcaption></figure><p>There are a few differences, however, which I’ll explain. But first, I need to set up the project.</p><h3>Project setup</h3><p>I will implement JavaFX client as another module within the Maven project, so the place to begin is with the client POM file:</p><pre>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;<br>         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;<br>  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;</pre><pre>  &lt;groupId&gt;com.oracle.coherence.examples&lt;/groupId&gt;<br>  &lt;artifactId&gt;todo-list-client&lt;/artifactId&gt;<br>  &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;</pre><pre>  &lt;properties&gt;<br>    &lt;coherence.groupId&gt;com.oracle.coherence.ce&lt;/coherence.groupId&gt;<br>    &lt;coherence.version&gt;20.06&lt;/coherence.version&gt;<br>  &lt;/properties&gt;</pre><pre>  &lt;dependencies&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;${coherence.groupId}&lt;/groupId&gt;<br>      &lt;artifactId&gt;coherence-java-client&lt;/artifactId&gt;<br>      &lt;version&gt;${coherence.version}&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;${coherence.groupId}&lt;/groupId&gt;<br>      &lt;artifactId&gt;coherence-json&lt;/artifactId&gt;<br>      &lt;version&gt;${coherence.version}&lt;/version&gt;<br>    &lt;/dependency&gt;</pre><pre>    &lt;!-- JavaFX dependencies --&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;org.openjfx&lt;/groupId&gt;<br>      &lt;artifactId&gt;javafx-controls&lt;/artifactId&gt;<br>      &lt;version&gt;14.0.2.1&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;org.openjfx&lt;/groupId&gt;<br>      &lt;artifactId&gt;javafx-fxml&lt;/artifactId&gt;<br>      &lt;version&gt;14.0.2.1&lt;/version&gt;<br>    &lt;/dependency&gt;</pre><pre>    &lt;!-- CDI support --&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;de.perdoctus.fx&lt;/groupId&gt;<br>      &lt;artifactId&gt;javafx-cdi-bootstrap&lt;/artifactId&gt;<br>      &lt;version&gt;2.0.0&lt;/version&gt;<br>    &lt;/dependency&gt;<br>    &lt;dependency&gt;<br>      &lt;groupId&gt;org.jboss.weld.se&lt;/groupId&gt;<br>      &lt;artifactId&gt;weld-se-core&lt;/artifactId&gt;<br>      &lt;version&gt;3.1.4.Final&lt;/version&gt;<br>    &lt;/dependency&gt;</pre><pre>  &lt;/dependencies&gt;</pre><pre>&lt;/project&gt;</pre><p>There isn’t anything surprising or very interesting in the code above. Note that it includes Coherence Java Client and JSON serialization support, as well as the dependencies needed for JavaFX and for contexts and dependency injection (CDI) support.</p><p>However, this is not sufficient, because the client doesn’t have a proxy that will enable it to talk to the server side yet. To fix that, add the following dependencies to the <em>server</em> POM file:</p><pre>&lt;dependency&gt;<br>  &lt;groupId&gt;${coherence.groupId}&lt;/groupId&gt;<br>  &lt;artifactId&gt;coherence-grpc-proxy&lt;/artifactId&gt;<br>  &lt;version&gt;${coherence.version}&lt;/version&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>  &lt;groupId&gt;${coherence.groupId}&lt;/groupId&gt;<br>  &lt;artifactId&gt;coherence-json&lt;/artifactId&gt;<br>  &lt;version&gt;${coherence.version}&lt;/version&gt;<br>&lt;/dependency&gt;</pre><p>To summarize, there are two new dependencies:</p><ul><li>The <strong>Coherence gRPC proxy</strong>, which contains the gRPC service implementation the gRPC client needs</li><li><strong>Coherence JSON</strong>, which is the same dependency as on the client and provides the JSON serialization support I want to use between the client and the server</li></ul><p>That’s pretty much it. The Coherence gRPC proxy is built on top of Helidon gRPC Server, which will be added as a transitive dependency. Just like the Helidon Web Server, Helidon gRPC Server will be bootstrapped by the CDI at startup if it is present in the classpath, and any discovered gRPC services will be deployed automatically. There is nothing else do, since the Helidon gRPC Server default configuration works just fine for this project’s purposes.</p><p>In addition to creating a Maven project, I need to enable CDI by creating a META-INF/beans.xml file:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</pre><pre>&lt;beans xmlns=&quot;http://xmlns.jcp.org/xml/ns/javaee&quot;<br>        xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>        xsi:schemaLocation=&quot;http://xmlns.jcp.org/xml/ns/javaee<br>                           http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd&quot;<br>        version=&quot;2.0&quot;<br>        bean-discovery-mode=&quot;annotated&quot;/&gt;</pre><p>Now that there is a client project, and the needed dependencies are added to the server project, I can start client implementation.</p><h3>Implementation</h3><p>Just as with the React client, I’m not going to discuss the UI implementation; I will focus on the code that interacts with Coherence instead. The first step is to create a data model class for the tasks, which is almost identical to the class on the server:</p><pre>package com.oracle.coherence.examples.todo.client;</pre><pre>public class Task<br>    {<br>    private String id;<br>    private long createdAt;<br>    private String description;<br>    private Boolean completed;</pre><pre>    /**<br>     * Construct Task instance.<br>     *<br>     * @param description  task description<br>     */<br>    public Task(String description)<br>        {<br>        this.id = UUID.randomUUID().toString().substring(0, 6);<br>        this.createdAt = System.currentTimeMillis();<br>        this.description = description;<br>        this.completed = false;<br>        }</pre><pre>    // accessors omitted for brevity<br>    }</pre><p>There are really only two differences between the server-side and client-side implementation of the Task class. The first one is that the client class does not implement the Serializable interface, which doesn’t really matter all that much. However, the second difference is important and needs to be discussed.</p><p>Although the two classes have the same set of fields and look very much alike, they are not the <em>same</em> class, because they are in different packages. This means I cannot use Java serialization for marshaling data between the client and the server, because that would require a <em>shared</em> data class to be used.</p><p>That’s one reason for using JSON to marshal data between the client and the server: It allows me to deserialize compatible payloads into different classes on both ends of the pipe. The same would be true if I had chosen to use the Portable Object Format (POF), which might a better choice from a performance perspective, but I’m not really concerned about that in this sample application.</p><p>However, there is still one issue to be faced: Unlike the REST API implemented earlier, which can infer the class to use when deserializing the JSON payload from the strongly typed JAX-RS method signatures, Coherence’s NamedMap&lt;K,V&gt; is a <em>generic</em> interface, which makes it impossible to infer the type. To solve that problem, Coherence JSON includes type information in the JSON payload during serialization by default, via the @class metaproperty.</p><p>For example, the JSON payload for a serialized server-side instance might look similar to this:</p><pre>{<br>  &quot;@class&quot;: &quot;com.oracle.coherence.examples.todo.server.Task&quot;,<br>  &quot;id&quot;: &quot;a3f764&quot;,<br>  &quot;completed&quot;: true,<br>  &quot;createdAt&quot;: 1596105656378,<br>  &quot;description&quot;: &quot;Write an article&quot;<br>}</pre><p>Can you see the problem? The name of the class doesn’t exist on the client embedded into the JSON payload. Fortunately, unlike Java serialization, Coherence JSON provides support for <em>type aliasing</em>. This makes it possible to register different classes on the server and the client under the same alias to make the JSON payload compatible with both.</p><p>To accomplish that, <a href="http://genson.io/Documentation/Extensions/">implement</a> a GensonBundleProvider both within the client and on the server:</p><pre>public class JsonConfig<br>        implements GensonBundleProvider<br>    {<br>    @Override<br>    public GensonBundle provide()<br>        {<br>        return new GensonBundle()<br>            {<br>            public void configure(GensonBuilder builder)<br>                {<br>                builder.addAlias(&quot;Task&quot;, Task.class);<br>                }<br>            };<br>        }<br>    }</pre><p>Apart from the package name, which is not shown above, the classes are identical and use whichever Task implementation is available in the classpath.</p><p>Next, add the com.oracle.coherence.io.json.GensonBundleProvider file to the META-INF/services directory, so custom providers can be discovered by the service loader and configured with the content of com.oracle.coherence.examples.todo.server.JsonConfig on the server and with com.oracle.coherence.examples.todo.client.JsonConfig on the client.</p><p>Once the necessary JSON configuration is in place, the payload above becomes</p><pre>{<br>  &quot;@class&quot;: &quot;Task&quot;,<br>  &quot;id&quot;: &quot;a3f764&quot;,<br>  &quot;completed&quot;: true,<br>  &quot;createdAt&quot;: 1596105656378,<br>  &quot;description&quot;: &quot;Write an article&quot;<br>}</pre><p>And it can be deserialized on the client and on the server successfully using locally a registered implementation of the Task class.</p><blockquote>Note that Coherence JSON uses an embedded, heavily customized version of the Genson JSON serializer. The embedded Genson serializer is in a different package to prevent conflicts in case the official Genson release is also used by an application.</blockquote><blockquote>For the most part, you shouldn’t have to care about this. As long as you annotate your data classes with either JSON-B or Jackson annotations (when necessary), everything should just work, and you can use other JSON implementations for other purposes. As a matter of fact, once that’s in place, the REST API uses the reference JSON-B implementation, <a href="https://github.com/eclipse-ee4j/yasson">Eclipse Yasson</a>, which is brought in by Helidon.</blockquote><p>With that out of the way, it’s time to return to the client implementation. All of the important logic is within the TaskManager class:</p><pre>@ApplicationScoped<br>public class TaskManager<br>    {<br>    /**<br>     * A {@link Filter} to retrieve completed tasks.<br>     */<br>    private static final Filter&lt;Task&gt; COMPLETED = <br>            Filters.equal(&quot;completed&quot;, true);</pre><pre>    /**<br>     * A {@link Filter} to retrieve active tasks.<br>     */<br>    private static final Filter&lt;Task&gt; ACTIVE = <br>            Filters.equal(&quot;completed&quot;, false);</pre><pre>    /**<br>     * Tasks map.<br>     */<br>    @Inject<br>    @Remote<br>    private NamedMap&lt;String, Task&gt; tasks;</pre><pre>    ...<br>    }</pre><p>The code above should look familiar: It defines static fields for the two filters that will be used in various queries and injects a NamedMap containing the tasks.</p><p>However, there is one important difference. To inject a NamedMap obtained by the Coherence Java gRPC client, I need to add the @Remote qualifier to the injection point. If I didn’t do that, the Coherence CDI extension would inject the default NamedMap implementation and the JavaFX client would attempt to join the cluster, which is <em>not</em> what I want.</p><p>For the code above to work, I must configure the gRPC client to use the correct <em>session</em>.</p><p>The session defines which gRPC <em>channel</em> to use to connect to the server, as well as which <em>serializer</em> to use. So let’s add the following application.yaml file to the src/main/resources directory within the client module:</p><pre>coherence:<br>  sessions:<br>    - name: default<br>      serializer: json<br>      channel: default</pre><p>This file configures the client to use the JSON serializer and the default gRPC channel, so the client will attempt to connect to the gRPC server on localhost:1408.</p><p>That’s fine at the moment, because that’s precisely the setup I’ll use for testing, but I’ll have to add some additional configuration before the client can connect to the server once the server is deployed to Kubernetes, which is what will happen (sneak preview!) in the next article.</p><p>The good news is that because Helidon MP Config is used for configuration, I can easily override any of the values above (or add new ones) using system properties or environment variables. But let’s leave that for the next article as well.</p><blockquote>Note that the client is configured explicitly to use the JSON serializer, but I haven’t done anything similar on the proxy. The good news is I don’t have to. The proxy supports <strong>all</strong> available serialization formats, which are discovered by either CDI or the service loader, and it will use whichever serializer the client tells it to use.</blockquote><blockquote>In theory, the client could use a different format for each request, but in practice, each client will likely use the same format, as configured within the session above, for the duration of its connection to the proxy.</blockquote><p>Now, let’s continue with the TaskManager implementation and look at some of the data access methods:</p><pre>public void addTodo(String description)<br>    {<br>    Task todo = new Task(description);<br>    tasks.put(todo.getId(), todo);<br>    }</pre><pre>public Collection&lt;Task&gt; getAllTasks()<br>    {<br>    return tasks.values();<br>    }</pre><pre>public Collection&lt;Task&gt; getActiveTasks()<br>    {<br>    return tasks.values(ACTIVE);<br>    }</pre><pre>public Collection&lt;Task&gt; getCompletedTasks()<br>    {<br>    return tasks.values(COMPLETED);<br>    }</pre><pre>public void removeTodo(String id)<br>    {<br>    tasks.remove(id);<br>    }</pre><pre>public void removeCompletedTasks()<br>    {<br>    tasks.invokeAll(COMPLETED, Processors.remove(Filters.always()));<br>    }</pre><pre>public void updateCompleted(String id, Boolean completed)<br>    {<br>    tasks.invoke(id, Processors.update(&quot;setCompleted&quot;, completed));<br>    }</pre><pre>public void updateText(String id, String description)<br>    {<br>    tasks.invoke(id, Processors.update(&quot;setDescription&quot;, description));<br>    }</pre><p>Everything above is very similar to the code implemented within the REST API. To implement basic CRUD operations against the tasksmap, the code uses standard Map APIs such as put, remove, and values as well as NamedMap APIs such as invoke, invokeAll, and values overloads that accept a filter.</p><p><strong>Coherence aggregators.</strong> There are two additional methods in TaskManager that use a Coherence feature I haven’t discussed yet: <em>aggregators</em>.</p><pre>public int getActiveCount()<br>    {<br>    return tasks.aggregate(ACTIVE, Aggregators.count());<br>    }</pre><pre>public int getCompletedCount()<br>    {<br>    return tasks.aggregate(COMPLETED, Aggregators.count());<br>    }</pre><p>Coherence aggregators allow you to perform parallel, MapReduce-style aggregations across the cluster.</p><p>The example above uses a very basic Count aggregator, which simply returns the number of entries that satisfy the specified filter, but there are many other built-in aggregators that allow you to find minimum, maximum, and average values of a specific attribute, or even to group entries by some attribute and perform another aggregation within each group of entries. You can also implement your own custom aggregators.</p><p>The aggregators execute in parallel, which makes them very efficient and nearly linearly scalable, as long as they are implemented correctly. They will also automatically re-execute if there are cluster membership changes and data rebalancing, so the client application doesn’t have to worry about any of that.</p><p>In the example above, each member will determine the count of local entries that satisfy the specified criteria and return the <em>partial result</em> to the <em>root aggregator </em>executing on the client (or in this case, on the gRPC proxy), which will then <em>combine </em>those partial results into the <em>final result</em>.</p><p>In this case, the final result is a scalar value, but it could be literally anything.</p><blockquote>By the way, Coherence also provides a custom implementation of the Stream API introduced in Java 8, which is built on top of aggregators.</blockquote><blockquote>When you use the Coherence <a href="https://youtu.be/-d4cyW3Nmto?list=PLxqhEJ4CA3JtazSZ0CI9JyriEjyHkb-9R">Remote Stream API</a>, the stream pipeline definition will be sent to all cluster members using a custom aggregator, and it will be executed in parallel, not within a single JVM and across a handful of CPU cores, but possibly across hundreds of JVMs and thousands of cores.</blockquote><p>Finally, just as I had to observe Coherence events within the REST API and convert them into server-sent events (SSEs) that the web UI can consume, I need to do something similar here. The difference is that instead of converting Coherence MapEvents into SSE events, the code will convert them into standard CDI events. That way the JavaFX UI implementation can remain completely Coherence–agnostic and simply observe the CDI events as they are published:</p><pre>@Inject<br>private Event&lt;TaskEvent&gt; taskEvent;</pre><pre>/**<br> * Convert Coherence map events to CDI events.<br> */<br>void onTaskEvent(@Observes @MapName(&quot;tasks&quot;) <br>                 MapEvent&lt;String, Task&gt; event)<br>    {<br>    taskEvent.fire(<br>        new TaskEvent(event.getOldValue(), event.getNewValue()));<br>    }</pre><p>That concludes the JavaFX client implementation. It’s time to see if the new clients work as expected, letting you get rid of curl once and for all.</p><h3>Running the clients</h3><p>If you haven’t done so already, you should get the <a href="https://github.com/coherence-community/todo-list-example">code for the example from GitHub</a> because in this article I didn’t cover all the code that is necessary to run the application.</p><p>To access the React client, you must build and run the server, which is responsible for serving the front-end application and the REST API the front end depends on.</p><p>In the <a href="https://blogs.oracle.com/javamagazine/hello-coherence-community-edition-creating-cloud-native-stateful-applications-that-scale-part-1">previous article</a>, I was able to simply run the server within the IDE. But now you have to build the server using Maven to build the front end and package it into the server JAR file. As long as you have the latest version of Node.js and npm installed, this can be easily accomplished by simply running mvn install within the server directory.</p><blockquote>You will first need to run npm install within the server/src/main/web directory to install the necessary front-end dependencies. You need to do this only once.</blockquote><p>You can then run the server in the IDE, just as you did before, or from the command line by running mvn exec:exec. If everything goes well, you should see the server start, and after a few seconds, you should see the same Helidon log message mentioned in the first article:</p><pre>2020.08.11 03:16:00 INFO io.helidon.microprofile.server.ServerCdiExtension Thread[main,5,main]: Server started on http://localhost:7001 (and all other host addresses) in 11967 milliseconds (since JVM startup).</pre><p>You can now access the React front end (see <strong>Figure 4</strong>) by simply navigating to <a href="http://localhost:7001/,">http://localhost:7001/,</a> as the log message above suggests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XX-IvESUA7g_Fd_i.png" /><figcaption><strong>Figure 4.</strong> The React client UI</figcaption></figure><p>Feel free to play with the application and create some tasks. If you want to make it more interesting, open the application in multiple browser windows and see how all of them are kept in sync via events as you make changes.</p><p>Finally, start the JavaFX client by running mvn install in the client directory, and then run mvn javafx:run. You should see a UI similar to what’s shown in <strong>Figure 5</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TNBRg3kWQPZ83Ly1.png" /><figcaption><strong>Figure 5.</strong> The JavaFX client UI</figcaption></figure><p>Obviously, the initial list of tasks will depend on the tasks you’ve created earlier using the React client. Just as before, add some tasks and change the existing ones, and see how both applications stay in sync as you make changes.</p><p>Alternatively, if you don’t feel like running the code yourself, you can watch this video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FuCTfvCoqMDw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DuCTfvCoqMDw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FuCTfvCoqMDw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/4978f810009e13b547ab23d97e0beeb8/href">https://medium.com/media/4978f810009e13b547ab23d97e0beeb8/href</a></iframe><h3>Conclusion</h3><p>That’s it for this article, and it was a long one. The result is a To Do List application that you can run locally. That’s nice, but I’ll be the first to admit that it’s not all that useful.</p><p>In the third and final article, I’ll turn this toy demo application into a highly available production application that is deployed to a Kubernetes cluster, can be easily scaled out, and can be monitored using Prometheus, Grafana, and Jaeger.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d26d7840139" width="1" height="1" alt=""><hr><p><a href="https://medium.com/oracle-coherence/hello-coherence-part-2-8d26d7840139">Hello Coherence, Part 2</a> was originally published in <a href="https://medium.com/oracle-coherence">Oracle Coherence</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>