@celerispay/hazelcast-client 3.12.5 → 3.12.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/QUICK_START.md CHANGED
@@ -1,143 +1,232 @@
1
- # Quick Start - Fixed Hazelcast Node.js Client 3.12.5
1
+ # Hazelcast Node.js Client - Quick Start Guide
2
+
3
+ ## Version Information
4
+ - **Package**: `@celerispay/hazelcast-client`
5
+ - **Version**: `3.12.5-1`
6
+ - **Publisher**: CelerisPay
7
+ - **Base Version**: 3.12.5 (Hazelcast Inc.)
8
+
9
+ ## Overview
10
+ This is a production-ready, enhanced version of the Hazelcast Node.js client with critical failover fixes that resolve connection management issues in production environments.
2
11
 
3
12
  ## Installation
4
13
 
14
+ ### Install the Fixed Version
5
15
  ```bash
6
- # Install the fixed version
7
- npm install @celerispay/hazelcast-client@3.12.5
16
+ npm install @celerispay/hazelcast-client@3.12.5-1
17
+ ```
8
18
 
9
- # Or if you're using yarn
10
- yarn add @celerispay/hazelcast-client@3.12.5
19
+ ### Verify Installation
20
+ ```bash
21
+ npm list @celerispay/hazelcast-client
22
+ # Should show version 3.12.5-1
11
23
  ```
12
24
 
13
25
  ## Basic Usage
14
26
 
27
+ ### Import the Client
28
+ ```javascript
29
+ const { ClientConfig, HazelcastClient } = require('@celerispay/hazelcast-client');
30
+ ```
31
+
32
+ ### Create Client Configuration
15
33
  ```javascript
16
- const { HazelcastClient } = require('@celerispay/hazelcast-client');
17
-
18
- async function createClient() {
19
- const client = await HazelcastClient.newHazelcastClient({
20
- networkConfig: {
21
- addresses: ['10.0.20.30:5701', '10.0.20.31:5701'],
22
- connectionAttemptLimit: 5,
23
- connectionTimeout: 10000,
24
- redoOperation: true,
25
- smartRouting: true
26
- },
27
- properties: {
28
- 'hazelcast.client.connection.health.check.interval': 5000,
29
- 'hazelcast.client.connection.max.retries': 3,
30
- 'hazelcast.client.failover.cooldown': 5000,
31
- 'hazelcast.client.invocation.max.retries': 10
32
- }
33
- });
34
+ const config = new ClientConfig();
35
+ config.networkConfig.addresses = ['127.0.0.1:5701', '127.0.0.1:5702'];
36
+
37
+ // Enhanced failover settings (automatically configured)
38
+ config.properties['hazelcast.client.connection.health.check.interval'] = 5000;
39
+ config.properties['hazelcast.client.failover.cooldown'] = 5000;
40
+ config.properties['hazelcast.client.partition.refresh.min.interval'] = 2000;
41
+ ```
42
+
43
+ ### Connect and Use
44
+ ```javascript
45
+ async function main() {
46
+ const client = await HazelcastClient.newHazelcastClient(config);
47
+
48
+ const map = await client.getMap('myMap');
49
+ await map.put('key', 'value');
50
+
51
+ const value = await map.get('key');
52
+ console.log('Value:', value);
34
53
 
35
- return client;
54
+ await client.shutdown();
36
55
  }
56
+
57
+ main().catch(console.error);
37
58
  ```
38
59
 
39
60
  ## Key Improvements
40
61
 
41
- **Connection Health Monitoring** - Active health checks every 5 seconds
42
- **Automatic Failover** - Seamless switching to healthy nodes
43
- **Connection Cleanup** - No more connection leakage
44
- **Smart Retry Logic** - Intelligent retry with backoff
45
- ✅ **Partition Table Refresh** - Automatic partition ownership updates
46
- **Address Blocking** - Temporary blocking of failed addresses to prevent repeated failures
62
+ ### 1. **Robust Failover**
63
+ - Automatic detection of node failures
64
+ - Intelligent failover to healthy nodes
65
+ - Failover cooldown to prevent rapid switching
66
+
67
+ ### 2. **Connection Health Monitoring**
68
+ - Continuous connection health checks
69
+ - Automatic cleanup of failed connections
70
+ - Prevention of connection leakage
71
+
72
+ ### 3. **Address Blocking System**
73
+ - Temporary blocking of failed addresses (30 seconds)
74
+ - Automatic unblocking after block duration
75
+ - Prevention of repeated connection attempts
47
76
 
48
- ## Configuration
77
+ ### 4. **Enhanced Error Handling**
78
+ - Near cache crash prevention during failover
79
+ - Graceful degradation during cluster changes
80
+ - Comprehensive error logging
49
81
 
50
- ### Essential Properties
82
+ ### 5. **Intelligent Reconnection**
83
+ - Automatic reconnection to recovered nodes
84
+ - Smart ownership management
85
+ - Partition table refresh management
51
86
 
87
+ ## Configuration Properties
88
+
89
+ ### Connection Management
52
90
  ```javascript
53
- properties: {
54
- // Connection health monitoring
55
- 'hazelcast.client.connection.health.check.interval': 5000,
56
- 'hazelcast.client.connection.max.retries': 3,
57
- 'hazelcast.client.connection.retry.delay': 1000,
58
-
59
- // Failover control
60
- 'hazelcast.client.failover.cooldown': 5000,
61
- 'hazelcast.client.partition.refresh.min.interval': 2000,
62
-
63
- // Retry behavior
64
- 'hazelcast.client.invocation.max.retries': 10,
65
- 'hazelcast.client.partition.failure.backoff': 2000
66
- }
91
+ config.properties['hazelcast.client.connection.health.check.interval'] = 5000; // 5 seconds
92
+ config.properties['hazelcast.client.connection.max.retries'] = 3; // Max 3 retries
93
+ config.properties['hazelcast.client.connection.retry.delay'] = 1000; // 1 second delay
67
94
  ```
68
95
 
69
- ### Network Configuration
96
+ ### Failover Control
97
+ ```javascript
98
+ config.properties['hazelcast.client.failover.cooldown'] = 5000; // 5 seconds cooldown
99
+ config.properties['hazelcast.client.partition.refresh.min.interval'] = 2000; // 2 seconds minimum
100
+ ```
70
101
 
102
+ ### Retry Behavior
71
103
  ```javascript
72
- networkConfig: {
73
- addresses: ['node1:5701', 'node2:5701'],
74
- connectionAttemptLimit: 5, // Increased from 2
75
- connectionTimeout: 10000, // Increased from 5000
76
- redoOperation: true, // Changed from false
77
- smartRouting: true
78
- }
104
+ config.properties['hazelcast.client.invocation.max.retries'] = 10; // Max 10 retries
105
+ config.properties['hazelcast.client.partition.failure.backoff'] = 2000; // 2 seconds backoff
79
106
  ```
80
107
 
81
- ## Testing the Fix
108
+ ## Testing
82
109
 
110
+ ### Run the Test Suite
83
111
  ```bash
84
- # Run the failover tests
85
- npm test -- --grep "Connection Failover Test"
86
-
87
- # Run all tests
88
112
  npm test
89
113
  ```
90
114
 
91
- ## Migration from Previous Versions
115
+ ### Verify Configuration
116
+ ```bash
117
+ node -e "
118
+ const { ClientConfig } = require('@celerispay/hazelcast-client');
119
+ const config = new ClientConfig();
120
+ console.log('Enhanced properties:', Object.keys(config.properties).filter(p => p.includes('connection') || p.includes('failover')));
121
+ "
122
+ ```
123
+
124
+ ## Migration from Original Client
92
125
 
93
- 1. **Update package.json**:
94
- ```json
95
- "dependencies": {
96
- "@celerispay/hazelcast-client": "3.12.5"
97
- }
98
- ```
126
+ ### 1. **Update Package Name**
127
+ ```bash
128
+ # Remove original
129
+ npm uninstall hazelcast-client
99
130
 
100
- 2. **Update import statement**:
101
- ```javascript
102
- // Before
103
- const { HazelcastClient } = require('hazelcast-client');
104
-
105
- // After
106
- const { HazelcastClient } = require('@celerispay/hazelcast-client');
107
- ```
131
+ # Install fixed version
132
+ npm install @celerispay/hazelcast-client@3.12.5-1
133
+ ```
108
134
 
109
- 3. **No other code changes required** - All fixes are backward compatible
135
+ ### 2. **Update Import Statement**
136
+ ```javascript
137
+ // Before
138
+ const { ClientConfig } = require('hazelcast-client');
110
139
 
111
- ## What's Fixed
140
+ // After
141
+ const { ClientConfig } = require('@celerispay/hazelcast-client');
142
+ ```
112
143
 
113
- - **Before**: Client hangs on partition owner failure
114
- - **After**: Automatic failover to healthy nodes
144
+ ### 3. **No Code Changes Required**
145
+ - All existing code will work unchanged
146
+ - Failover behavior will automatically improve
147
+ - Connection management will be more robust
115
148
 
116
- - **Before**: Connection count keeps increasing
117
- - ✅ **After**: Failed connections are properly cleaned up
149
+ ## Production Recommendations
118
150
 
119
- - **Before**: Invocations hang indefinitely
120
- - ✅ **After**: Operations fail gracefully with retry limits
151
+ ### 1. **Enable Statistics**
152
+ ```javascript
153
+ config.properties['hazelcast.client.statistics.enabled'] = true;
154
+ ```
121
155
 
122
- - **Before**: No health monitoring
123
- - **After**: Active connection health checking
156
+ ### 2. **Monitor Logs**
157
+ Watch for these log messages:
158
+ - `"Starting failover process..."`
159
+ - `"Failover completed successfully"`
160
+ - `"Connection health check interval"`
161
+ - `"Address blocked for X seconds"`
124
162
 
125
- - **Before**: Repeated attempts to failed nodes
126
- - **After**: Temporary blocking of failed addresses (30 seconds)
163
+ ### 3. **Load Testing**
164
+ Test failover scenarios under load:
165
+ - Stop partition owner nodes
166
+ - Monitor automatic failover
167
+ - Verify reconnection to recovered nodes
127
168
 
128
- ## Production Recommendations
169
+ ### 4. **Network Configuration**
170
+ ```javascript
171
+ config.networkConfig.connectionAttemptLimit = 5; // Increased from default
172
+ config.networkConfig.connectionTimeout = 10000; // Increased from default
173
+ config.networkConfig.redoOperation = true; // Enable for better failover
174
+ ```
129
175
 
130
- 1. **Enable Statistics**: `'hazelcast.client.statistics.enabled': true`
131
- 2. **Monitor Logs**: Watch for failover events and address blocking
132
- 3. **Load Test**: Verify failover behavior under load
133
- 4. **Health Checks**: Use connection health metrics
176
+ ## What's Fixed
177
+
178
+ ### **Connection Bombardment**
179
+ - No more repeated connection attempts to failed nodes
180
+ - Intelligent address blocking prevents network spam
181
+ - Connection health monitoring detects failures early
182
+
183
+ ### ✅ **Failover Failures**
184
+ - Automatic failover to healthy nodes
185
+ - Proper partition table management during failover
186
+ - Failover cooldown prevents rapid switching
187
+
188
+ ### ✅ **Near Cache Crashes**
189
+ - Comprehensive error handling prevents crashes
190
+ - Graceful degradation during cluster changes
191
+ - Safe fallback values during failover
192
+
193
+ ### ✅ **Connection Leakage**
194
+ - Automatic cleanup of failed connections
195
+ - Periodic connection health checks
196
+ - Memory leak prevention
197
+
198
+ ### ✅ **Hanging Operations**
199
+ - Maximum retry limits prevent infinite loops
200
+ - Proper error handling and logging
201
+ - Graceful failure with user feedback
134
202
 
135
203
  ## Support
136
204
 
137
- - **Documentation**: See `FAILOVER_FIXES.md` for detailed information
138
- - **Tests**: Run test suite to verify functionality
139
- - **Issues**: Report problems in the repository
205
+ ### **Package Information**
206
+ - **Name**: `@celerispay/hazelcast-client`
207
+ - **Version**: `3.12.5-1`
208
+ - **Publisher**: CelerisPay
209
+
210
+ ### **Documentation**
211
+ - **Technical Details**: See `FAILOVER_FIXES.md`
212
+ - **Release Notes**: See `CHANGELOG.md`
213
+ - **Repository**: https://github.com/celerispay/hazelcast-nodejs-client
214
+
215
+ ### **Issues and Support**
216
+ - **GitHub Issues**: https://github.com/celerispay/hazelcast-nodejs-client/issues
217
+ - **Professional Support**: Available from CelerisPay
218
+
219
+ ## Expected Results
220
+
221
+ After implementing this fixed version, you should see:
222
+
223
+ 1. **Stable Connections**: No more connection bombardment to failed nodes
224
+ 2. **Automatic Failover**: Seamless switching to healthy nodes when failures occur
225
+ 3. **Better Performance**: Reduced network traffic and improved response times
226
+ 4. **Cleaner Logs**: Fewer error messages and better failure information
227
+ 5. **Production Stability**: Reliable operation even during cluster topology changes
140
228
 
141
229
  ---
142
230
 
143
- **Note**: This version (3.12.5) includes critical connection failover fixes and is published by CelerisPay. Consider upgrading to Hazelcast 4.x or 5.x for long-term support.
231
+ **Ready for Production**: This version has been thoroughly tested and is ready for production deployment with professional support from CelerisPay.
232
+