JDG Remote Client-Server Mode Usage Example: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 60: Line 60:
</pre>
</pre>


=Create a RemoteCacheManager=
=Create a RemoteCacheManager and a Cache=


=Features=
=Features=

Revision as of 14:45, 4 May 2017

Internal

Overview

The example is deployed in a wrapper servlet, to facilitate interaction.

GitHub

https://github.com/NovaOrdis/playground/tree/master/jboss/infinispan/remote-client-server-mode-access-from-eap

Maven

<dependency>
    <groupId>org.infinispan</groupId>
    <artifactId>infinispan-remote</artifactId>
    <version>8.3.0.Final-redhat-1</version>
    <scope>provided</scope>
</dependency>

If support for remote client-server JDG is deployed within the target EAP (preferred), declare the dependency <scope>provided</scope> and configure the jboss-deployment-structure.xml as shown:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.infinispan.client.hotrod" slot="jdg-7.0"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Otherwise, all required dependencies it with your deployment, by not declaring them "provided".

HotRod Client Configuration

import org.infinispan.client.hotrod.configuration.Configuration;
import org.infinispan.client.hotrod.configuration.ConfigurationBuilder;

...

ConfigurationBuilder cb = new ConfigurationBuilder();

cb.tcpNoDelay(true)
                .connectionPool()
                .numTestsPerEvictionRun(3)
                .testOnBorrow(false)
                .testOnReturn(false)
                .testWhileIdle(true)
                .addServer()
                .host(JDG_SERVER_IP_ADDRESS)
                .port(JDG_SERVER_IP_PORT);

Configuration c = cb.build();

Create a RemoteCacheManager and a Cache

Features

Basic API

Transactions