Este contenido no está disponible en el idioma seleccionado.
Chapter 36. Integration with EAP
36.1. Integration with EAP Copiar enlaceEnlace copiado en el portapapeles!
While EAP includes Infinispan modules, they are intended for internal EAP use, and are not supported with JBoss Data Grid. To use JDG within EAP, use the JDG provided EAP modules. Using these modules will avoid any conflict with EAP’s internal modules because the slot will be different. Using them will also allow for deployment of an application without packaging JDG within the deployments (WARs, EARs, etc.), thus minimizing their size.
36.2. Installation of EAP Modules Copiar enlaceEnlace copiado en el portapapeles!
The modules for EAP can be downloaded from the Red Hat Customer Portal:
Procedure: Download EAP Modules
- Log into the Customer Portal at https://access.redhat.com.
- Click the Downloads button near the top of the page.
- In the Product Downloads page, click Red Hat JBoss Data Grid.
- Select the appropriate JBoss Data Grid version from the Version: drop down menu.
- Locate the Red Hat JBoss Data Grid 7.2 Library Module for JBoss EAP entry and click the corresponding Download link.
The zip file should be extracted to EAP_HOME/modules
. If the files were extracted correctly the infinispan core module would be under EAP_HOME/modules/org/infinispan/core
.
36.3. EAP Dependencies Copiar enlaceEnlace copiado en el portapapeles!
To configure the modules using Maven, mark the JDG dependencies as provided and configure the artifact archiver to generate a WAR file with the proper MANIFEST.MF
using the following pom.xml
:
pom.xml
36.4. Dependencies for Specific JDG Components Copiar enlaceEnlace copiado en el portapapeles!
Various example MANIFEST.MF
configuration files to enable specific features of JDG are provided below.
36.4.1. Core Dependencies Copiar enlaceEnlace copiado en el portapapeles!
To expose only JDG core dependencies to an application, add the following to the manifest:
MANIFEST.MF
Manifest-Version: 1.0 Dependencies: org.infinispan:jdg-7.2 services
Manifest-Version: 1.0
Dependencies: org.infinispan:jdg-7.2 services
36.4.2. Remote/Hot Rod Dependencies Copiar enlaceEnlace copiado en el portapapeles!
To connect to remote JDG servers via Hot Rod, including for execution of remote queries, use the module
. This exposes all needed dependencies automatically:
org.infinispan.remote
MANIFEST.MF
Manifest-Version: 1.0 Dependencies: org.infinispan.remote:jdg-7.2 services
Manifest-Version: 1.0
Dependencies: org.infinispan.remote:jdg-7.2 services
36.4.3. Embedded Querying Dependencies Copiar enlaceEnlace copiado en el portapapeles!
For embedded querying, including the Infinispan Query DSL, Lucene, and Hibernate Search Queries, add the following to the manifest:
MANIFEST.MF
Manifest-Version: 1.0 Dependencies: org.infinispan:jdg-7.2 services, org.infinispan.query:jdg-7.2 services
Manifest-Version: 1.0
Dependencies: org.infinispan:jdg-7.2 services, org.infinispan.query:jdg-7.2 services
36.4.4. Lucene Directory Dependencies Copiar enlaceEnlace copiado en el portapapeles!
To use JDG as a directory for Lucene using org.apache.lucene.store.Directory, the query module isn’t needed, the following is sufficient
MANIFEST.MF
Manifest-Version: 1.0 Dependencies: org.infinispan.lucene-directory:jdg-7.2 services
Manifest-Version: 1.0
Dependencies: org.infinispan.lucene-directory:jdg-7.2 services
36.4.5. Hibernate Search Directory Provider Dependencies Copiar enlaceEnlace copiado en el portapapeles!
The Hibernate Search directory provider for JDG is also contained within the JBoss Data Grid 7.2 Library Module for JBoss EAP zip file. It is not necessary to add an entry to the manifest file since the Hibernate Search module already has an optional dependency to it. When deciding what JDG module zip to use, start by checking which Hibernate Search is in use.
36.4.6. Using EAP’s Internal Hibernate Search Modules Copiar enlaceEnlace copiado en el portapapeles!
The Hibernate Search module present in EAP 7.1 has version 5.5.x, and has an optional dependency to module org.infinispan.hibernate-search.directory-provider
, with slot for-hibernatesearch-5.5
. This dependency is available once the Infinispan modules are installed.
36.4.7. Usage with Other Hibernate Search Modules Copiar enlaceEnlace copiado en el portapapeles!
The module org.hibernate.search:jdg-7.2
distributed with JDG is to be used together with Infinispan Query only (querying data from caches), and should not be used by Hibernate ORM applications. To use a Hibernate Search with a different version that is present in EAP, consult the Hibernate Search documentation.
Make sure the chosen Hibernate Search optional slot for org.infinispan.hibernate-search.directory-provider
matches the one distributed with JBoss Data Grid.
36.5. Usage of EAP Modules Copiar enlaceEnlace copiado en el portapapeles!
An application can use JDG within EAP either in Library (embedded) Mode, or in EAP Subsystem Mode.
36.5.1. Library Mode Copiar enlaceEnlace copiado en el portapapeles!
When using JDG within EAP in Library Mode, all CacheManager
and cache instances are created in application logic. As such, the lifecycle of the EmbeddedCacheManager
is tightly coupled with the application’s lifecycle, resulting in any manager instances created by the application being destroyed when the application is destroyed.
36.5.2. EAP Subsystem Mode Copiar enlaceEnlace copiado en el portapapeles!
In EAP Subsystem Mode, where JDG is a subsystem to EAP, it’s possible for cache containers and caches to be created before runtime as part of EAP’s domain/configuration/domain.xml
configuration. This allows cache instances to be shared across multiple applications, with the lifecycle of the underlying cache container being independent of the deployed application.
36.6. Configuration for EAP Subsystem Mode Copiar enlaceEnlace copiado en el portapapeles!
To enable EAP Subsystem Mode, add the following to the EAP configuration in domain/configuration/domain.xml
.
Only the first two steps are required for local cache instances.
-
Add the infinispan extensions to the
<extensions>
section
- Configure the Infinispan subsystem, along with all required containers and caches, in the server profile which requires Infinispan.
Ensure the module attribute is defined or else the correct Infinispan classes won’t be loaded.
- Define the EAP interface and socket bindings required by JGroup subsystems.
Interface definition:
<interfaces> <interface name="jdg"> <inet-address value="${jdg.bind.address:127.0.0.1}"/> </interface> </interfaces>
<interfaces>
<interface name="jdg">
<inet-address value="${jdg.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
Socket bindings definition:
<socket-binding-group name="full-sockets" default-interface="public"> <socket-binding name="jdg-jgroups-udp" interface="jdg" port="55200" multicast-address="${jdg.default.multicast.address:230.0.0.4}" multicast-port="45688"/> <socket-binding name="jdg-jgroups-udp-fd" interface="jdg" port="54200"/> </socket-binding-group>
<socket-binding-group name="full-sockets" default-interface="public">
<socket-binding name="jdg-jgroups-udp" interface="jdg" port="55200" multicast-address="${jdg.default.multicast.address:230.0.0.4}" multicast-port="45688"/>
<socket-binding name="jdg-jgroups-udp-fd" interface="jdg" port="54200"/>
</socket-binding-group>
For more information on EAP interface and socket bindings see Network and Port Configuration in the EAP Configuration Guide.
- Define JGroups transport, ensuring the model attribute, for all protocols specified, is defined.
A command line script is also available to configure server mode:
To add the cache use the following command:
add a simple cache
# add a simple cache
/profile=full/subsystem=datagrid-infinispan/cache-container=jdg-container/distributed-cache=default:add(configuration=default)
36.7. Accessing Containers and Caches Remotely Copiar enlaceEnlace copiado en el portapapeles!
Once a container has been defined in the server’s configuration, it is possible to inject an instance of a CacheContainer
or Cache
into the application using the @Resource
JNDI lookup. A container is accessed using the string java:jboss/datagrid-infinispan/container/<container_name>
, and similarly, a cache is accessed via java:jboss/datagrid-infinispan/container/<container_name>/cache/<cache_name>
.
The example below shows how to inject the CacheContainer
called "jdg-container" and the distributed cache "default" into an application.
This example code has a dependency on the jdg-7.2
module.
36.8. Troubleshooting EAP and JDG in EAP Subsystem Mode Copiar enlaceEnlace copiado en el portapapeles!
36.8.1. Enable logging Copiar enlaceEnlace copiado en el portapapeles!
Enabling trace on org.jboss.modules
can be useful to debug issues like LinkageError
and ClassNotFoundException
. To enable trace logging at runtime use the EAP CLI:
bin/jboss-cli.sh -c '/subsystem=logging/logger=org.jboss.modules:add' bin/jboss-cli.sh -c '/subsystem=logging/logger=org.jboss.modules:write-attribute(name=level,value=TRACE)'
bin/jboss-cli.sh -c '/subsystem=logging/logger=org.jboss.modules:add'
bin/jboss-cli.sh -c '/subsystem=logging/logger=org.jboss.modules:write-attribute(name=level,value=TRACE)'
36.8.2. Print Dependency Tree Copiar enlaceEnlace copiado en el portapapeles!
The following command can be used to print all dependencies for a certain module. For example, to obtain the tree for the module org.infinispan:jdg-7.2
, execute the following from EAP_HOME
:
java -jar jboss-modules.jar -deptree -mp modules/ "org.infinispan:jdg-7.2"
java -jar jboss-modules.jar -deptree -mp modules/ "org.infinispan:jdg-7.2"