-
1. Re: Wildfly Session Externalizing to Database
pferraro Nov 6, 2017 7:26 AM (in response to sarojchoudhury4)Using WF 11.0.0.Final, use one of the ha profiles and make the following modifications:
1. Create a datasource resource (via the datasources subsystem) describing the database to which you intend to store web session data.
2. Create a new cache resource using a shared, persistent jdbc store (referencing the name of your datasource defined in step #1) within the "web" cache-container in the Infinispan subsystem, e.g.
<invalidation-cache name="jdbc" mode="SYNC"> <transaction mode="BATCH"/> <string-keyed-jdbc-store data-source="..." passivation="false" shared="true"/> </invalidation-cache>
3. Modify your default-cache of the web cache-container to use this new configuration
<cache-container name="web" default-cache="jdbc">...</cache-container>
4. Ensure your web applications use <distributable/> in their web.xml
-
2. Re: Wildfly Session Externalizing to Database
pgnemo Apr 26, 2018 1:14 AM (in response to pferraro)Is this supported in Wildfly 10.0?
-
3. Re: Wildfly Session Externalizing to Database
pferraro Apr 26, 2018 9:59 AM (in response to pgnemo)Yes - but you'll need to use the <binary-keyed-jdbc-store/> instead, which is far less efficient.
-
4. Re: Wildfly Session Externalizing to Database
pgnemo Apr 26, 2018 10:27 AM (in response to pferraro)pferraro , I came across 18.6. JDBC Based Cache Stores - Red Hat Customer Portal. Is there any other documentation that you recommend?
Should I manually create the session table or Wildfly will take care of it?
-
5. Re: Wildfly Session Externalizing to Database
pferraro Apr 26, 2018 10:43 PM (in response to pgnemo)I came across 18.6. JDBC Based Cache Stores - Red Hat Customer Portal. Is there any other documentation that you recommend?
That is product documentation for an old version of JBoss Data Grid (a different product), so the configuration schema is not the same.
See the Infinispan subsystem schema for configuration details:
wildfly/jboss-as-infinispan_4_0.xsd at 10.x · wildfly/wildfly · GitHub
Should I manually create the session table or Wildfly will take care of it?
Infinispan will automatically create the requisite database table. All you need to specify is the pool-name of the data-source resource (it should be defined in the datasources subsystem) and the dialect (i.e your database vendor).
e.g.
<binary-keyed-jdbc-store data-source="ExampleDS" dialect="HSQL"/>
-
6. Re: Wildfly Session Externalizing to Database
pgnemo Apr 27, 2018 1:28 PM (in response to pferraro)pferraro I was going through the schema and realized that there is no Neo4j in dialect. So if the DB vendor is not listed, still can we use our own DB? If so do we need to write our own wrapper?
-
7. Re: Wildfly Session Externalizing to Database
pferraro Apr 30, 2018 10:13 AM (in response to pgnemo)You probably don't want to use a jdbc-store to integrate with Neo4J (as it isn't an RDBMS). Instead you probably want to use the JPA store [1] in conjunction with Hibernate OGM and its support for Neo4J [2].
[1] JPA Cache Store
-
8. Re: Wildfly Session Externalizing to Database
pgnemo May 4, 2018 12:53 PM (in response to pferraro)pferraro Really appriccaite your help. I tried with Neo4j but we hit internal roadblocks. So now I have decided not to use infinispan for session management and to implement my own by using underflow session management which I read here. Am I on the right track?
-
9. Re: Wildfly Session Externalizing to Database
pferraro May 6, 2018 4:18 PM (in response to pgnemo)You can do this in one of 2 ways:
* Implement Undertow's SessionManager API and integrate via a ServletExtension (as described in that stackoverflow post).
* Implement WildFly's distibuted session manager SPI: wildfly/clustering/web/spi/src/main/java/org/wildfly/clustering/web/session at master · wildfly/wildfly · GitHub
- Package your implementation as a module
- Replace this line with your new module: wildfly/module.xml at master · wildfly/wildfly · GitHub