이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 4. Migrating to Data Grid 8 APIs


Find changes to Data Grid APIs that affect migration to Data Grid 8.

API deprecations and removals

In addition to details in this section, you should also review API deprecations and removals.

See Data Grid Deprecated Features and Functionality (Red Hat Knowledgebase).

4.1. REST API

Data Grid 7.x used REST API v1 which is replaced with REST API v2 in Data Grid 8.

The default context path for REST API v2 is <server_hostname>:11222/rest/v2/. You must update any clients or scripts to use REST API v2.

The performAsync header was also removed from the REST endpoint. Clients that perform async operations with the REST endpoint should manage the request and response on their side to avoid blocking.

REST operations PUT, POST and DELETE methods now return status 204 (No content) instead of 200 if the request does not return resources.

Additional resources

4.2. Query API

Data Grid 8 brings an updated Query API that is easier to use and has a lighter design. You get more efficient query performance with better results when searching across values in distributed caches, in comparison with Data Grid 7.x.

Note

Because the Data Grid 8 Query API has gone through considerable refactoring, there are several features and functional resources that are now deprecated.

This topic focuses on changes that you need to make to your configuration when migrating from a previous version. Those changes should include planning to remove all deprecated interfaces, methods, or other configuration.

See the Data Grid Deprecations and Removals (Red Hat Knowledgebase) for the complete list of deprecated features and functionality.

Indexing Data Grid caches

The Data Grid Lucene Directory, the InfinispanIndexManager and AffinityIndexManager index managers, and the Infinispan Directory provider for Hibernate Search are deprecated in 8.0 and removed in 8.1.

The auto-config attribute is deprecated in 8.1 and planned for removal.

The index() method that configures the index mode configuration is deprecated. When you enable indexing in your configuration, Data Grid automatically chooses the best way to manage indexing.

Important

Several indexing configuration values are no longer supported and result in fatal configuration errors if you include them.

You should make the following changes to your configuration:

  • Change .indexing().index(Index.NONE) to indexing().enabled(false)
  • Change all other enum values as follows: indexing().enabled(true)

Declaratively, you do not need to specify enabled="true" if your configuration contains other indexing configuration elements. However, you must call the enabled() method if you programmatically configure indexing. Likewise Data Grid configuration in JSON format must explicitly enable indexing, for example:

"indexing": {
      "enabled": "true"
      ...
      },

Indexed types

You must declare all indexed types in the indexing configuration or Data Grid logs warning messages when undeclared types are used with indexed caches. This requirement applies to both Java classes and Protobuf types.

Enabling indexing in Data Grid 8
  • Declaratively

    <distributed-cache name="my-cache">
       <indexing>
         <indexed-entities>
           <indexed-entity>com.acme.query.test.Car</indexed-entity>
           <indexed-entity>com.acme.query.test.Truck</indexed-entity>
         </indexed-entities>
       </indexing>
    </distributed-cache>
  • Programmatically

    import org.infinispan.configuration.cache.*;
    
    ConfigurationBuilder config=new ConfigurationBuilder();
    config.indexing().enable().addIndexedEntity(Car.class).addIndexedEntity(Truck.class);

Querying values in caches

The org.infinispan.query.SearchManager interface is deprecated in Data Grid 8 and no longer supports Lucene and Hibernate Search native objects.

Removed methods

  • .getQuery() methods that take Lucene Queries. Use the alternative methods that take Ickle queries from the org.infinispan.query.Search entry point instead.

    Likewise it is no longer possible to specify multiple target entities classes when calling .getQuery(). The Ickle query string provides entities instead.

  • .buildQueryBuilderForClass() that builds Hibernate Search queries directly. Use Ickle queries instead.

The org.infinispan.query.CacheQuery interface is also deprecated. You should obtain the org.infinispan.query.dsl.Query interface from the Search.getQueryFactory() method instead.

Note that instances of org.infinispan.query.dsl.Query no longer cache query results and allow queries to be re-executed when calling methods such as list().

Entity mappings

You must now annotate fields that require sorting with @SortableField in all cases.

Red Hat logoGithubRedditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.