You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optionally you can override default Couchbase client settings by creating `CouchbaseEnvironment` bean:
70
+
For full list of supported Spring Data Couchbase properties see [here](http://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html).
65
71
66
-
```java
67
-
...
68
-
@Primary
69
-
@Bean(destroyMethod = "shutdown", name = "couchbaseEnv")
70
-
public CouchbaseEnvironment couchbaseEnvironment() {
71
-
...
72
-
}
72
+
Using Couchbase backed HTTP session you can share session among multiple web applications in a distributed system.
73
+
The session will not be destroyed when the web applications will be shut down.
74
+
75
+
#### Retrying
76
+
By default there is only one attempt to query Couchbase.
77
+
It is possible to retry the query operation when an error occurs.
78
+
The number of retries can be controlled in _application.yml_ file:
79
+
80
+
```yaml
81
+
session-couchbase.persistent.retry.max-attempts: <number of attempts>
73
82
```
74
83
75
-
##### Additional info
76
-
Using Couchbase backed HTTP session you can share session among multiple web applications.
77
-
The session will not be destroyed when the web applications will be shut down.
84
+
The concurrent modification errors: `DML Error, possible causes include CAS mismatch or concurrent modificationFailed to perform update` can be avoided by increasing the number of maximum attempts.
78
85
79
-
You can access session attributes in 2 ways:
86
+
### In-memory usage
87
+
Enable in-memory mode in _application.yml_ file:
88
+
89
+
```yaml
90
+
session-couchbase.in-memory.enabled: true
91
+
```
92
+
93
+
Using in-memory HTTP session you can not share session among multiple web applications in a distributed.
94
+
The session is visible only within a single web application instance and will be destroyed when the web application will be shut down.
95
+
96
+
The mode is useful for integration tests when you don't want to communicate with the real Couchbase server instance.
97
+
98
+
## Namespaces
99
+
The starter supports HTTP session namespaces.
100
+
Each web application in a distributed system has one application namespace under which the session attributes are stored.
101
+
Every web application can also access global session attributes which are visible across the whole distributed system.
102
+
Namespaces prevent conflicts in attributes names between different web applications in the system.
103
+
Two web applications can have the same namespace and therefore access the same session attributes.
104
+
If two web applications have different namespaces they cannot access each others session attributes.
105
+
106
+
You can access session attributes in 2 ways, using:
80
107
- _application namespace_ - attributes are visible only to instances of the same web application within a distributed system
81
108
- _global namespace_ - attributes are visible to all instances of all web applications within a distributed system
82
109
83
-
To access application namespace just pass an attribute name:
110
+
To access application namespace attribute just pass an attribute name:
84
111
85
112
```java
86
113
...
@@ -93,7 +120,7 @@ public void doSomething(HttpSession session) {
93
120
}
94
121
```
95
122
96
-
To access global attributes create an attribute name using `CouchbaseSession.globalAttributeName(...)` method:
123
+
To access global attribute create an attribute name using `CouchbaseSession.globalAttributeName(...)` method:
97
124
98
125
```java
99
126
...
@@ -108,34 +135,18 @@ public void doSomething(HttpSession session) {
108
135
109
136
When changing HTTP session ID every attribute is copied to the new session, no matter what namespace it belongs.
110
137
111
-
### In-memory usage
112
-
Enable in-memory mode in _application.yml_ file:
113
-
114
-
```yaml
115
-
session-couchbase.in-memory.enabled: true
116
-
```
117
-
118
-
##### Additional info
119
-
Using in-memory HTTP session you can not share session among multiple web applications.
120
-
The session is visible only within a single web application instance and will be destroyed when the web application will be shut down.
121
-
122
-
There are no namespaces in the in-memory mode.
123
-
124
-
The mode is useful for integration tests when you don't want to communicate with the real Couchbase server instance.
125
-
126
138
## Configuration properties list
127
139
128
140
```yaml
129
141
session-couchbase:
130
142
timeout-in-seconds: 1800 # HTTP session timeout.
143
+
application-namespace: # HTTP session application namespace under which session data must be stored.
144
+
principal-sessions:
145
+
enabled: false # Flag for enabling and disabling finding HTTP sessions by principal. Can significantly decrease application performance when enabled.
131
146
persistent:
132
-
namespace: # HTTP session application namespace under which session data must be stored.
133
-
couchbase:
134
-
hosts: localhost # Couchbase cluster hosts.
135
-
bucket-name: default # Couchbase bucket name where session data must be stored.
136
-
password: # Couchbase bucket password.
137
-
principal-sessions:
138
-
enabled: false # Flag for enabling and disabling finding HTTP sessions by principal. Can significantly decrease application performance when enabled.
0 commit comments