Coherence Community Edition 21.06 Released!

While I was on my two week road trip up the North of Western Australia, Coherence CE 21.06 was released!

On our road trip up north of Western Australia

My holiday was great, but now I’m back at work, I’d like to share some exciting new features introduced in the Coherence CE 21.06 release. The full list is available at the Coherence CE release page, but I have included a few of these below:

  • The Repository API
  • Durable Events (Experimental)
  • Topics Improvements
  • Partition Event Logging
  • Non-Blocking Entry Stores

Repository API

This new higher-level API for Coherence implements the Repository Pattern and provides Domain Driven Design (DDD) friendly way of accessing Coherence on top of the NameMap API.

Below is a simple example of a CustomerRepository:

public static class CustomerRepository 
        extends AbstractRepository<Integer, Customer> {

        private NamedMap<Integer, Customer> customers;

        public CustomerRepository(NamedMap<Integer, Customer> customers) {
            this.customers = customers;
        }

        @Override
        protected NamedMap<Integer, Customer> getMap() {
            return customers;
        }

        @Override
        protected Integer getId(Customer customer) {
            return customer.getId();
        }

        @Override
        protected Class<? extends Customer> getEntityType() {
            return Customer.class;
        }
    }

To use this, with Coherence we can do the following:

CustomerRepository customers = new
    CustomerRepository(Session.create().getMap("customers"));

// create a new customer
customers.save(new Customer(1, "Tim", "Address", Customer.GOLD, 1000));

// find the customer
Customer c = customers.get(1);

// update the customer address
customers.update(1, Customer::setAddress, "New Address");

There is so much more you can do with the Repository API, including, but not limited to: searching, aggregations, streaming and integration with our Spring and Micronaut implementations.

There is also an Async implementation of the API as well and it it works nicely with standard Java applications as well as applications that use CDI. As Aleks Seovic mentioned in his Medium post:

“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.”

Original Medium Post

See the full documentation here.

Durable Events (Experimental)

This new experimental feature extends the Coherence events features so you never lose an events if your client has disconnected and re-connects, allowing clients to keep track of event versions and request replay of events

See the Durable Events documentation and sample guide here.

Topics Improvements

There has been some significant changes to the Coherence Topics feature to support explicit client acknowledgements. You can browse the documentation here.

Partition Events Logging

This new feature allows you to get more information on when and for how long partitions may be blocked due to partition transfer, restore or any other reason. There is extensive documentation on how to enable and understand the messages here.

Non-Blocking Entry Stores

Coherence provides a means of integrating with underlying data sources using a number of existing strategies; namely, read-through, write-through, write-behind and refresh-ahead. Coherence now also provides a NonBlockingEntryStore interface for integrating with data sources that provide non-blocking APIs.

This new strategy is similar in nature to write-behind, as it is asynchronous to the original mutation, however does not require a queue to defer the call to the store and immediately passes the intent to store to the implementer. The implementer can in-turn immediately call the non-blocking api of the data source and on success or failure a future can pass that information to the provided StoreObserver via onNext or onError respectively.

Resources

Enjoy!

This entry was posted in New Features and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s