chore(*): finnaly make it work
This commit is contained in:
parent
df4e121b4e
commit
ba120c3fa7
@ -1,9 +1,11 @@
|
||||
<hazelcast xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.hazelcast.com/schema/config http://www.hazelcast.com/schema/config/hazelcast-config-3.8.xsd" xmlns="http://www.hazelcast.com/schema/config">
|
||||
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.12.xsd"
|
||||
xmlns="http://www.hazelcast.com/schema/config"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<group>
|
||||
<name>ona</name>
|
||||
<password>123456</password>
|
||||
<name>superadmin</name>
|
||||
<password>dev-pass</password>
|
||||
</group>
|
||||
<network>
|
||||
<network>
|
||||
<public-address>onaintdata1</public-address>
|
||||
<port auto-increment="false">5701</port>
|
||||
<join>
|
||||
|
||||
38
js/index.js
38
js/index.js
@ -1,34 +1,22 @@
|
||||
const Haz = require('hazelcast-client');
|
||||
// const config = new Haz.Config.ClientConfig();
|
||||
|
||||
let globalClient = null;
|
||||
|
||||
// config.listeners.addLifecycleListener(function (state) {
|
||||
// console.log('Lifecycle Event >>> ' + state);
|
||||
// if(state === 'shutdown'){
|
||||
// console.log('WE ARE DEAD!');
|
||||
// }
|
||||
// });
|
||||
const clientConfig = new Haz.Config.ClientConfig();
|
||||
|
||||
const cfg = {
|
||||
network: {
|
||||
clusterMembers: [
|
||||
'127.0.0.1:5701',
|
||||
]
|
||||
},
|
||||
groupConfig: {
|
||||
name: 'ona',
|
||||
password: '123456'
|
||||
},
|
||||
lifecycleListeners: [
|
||||
(state) => {
|
||||
console.log(`Hazelcast lifecycle Event >>> ${state}`);
|
||||
}],
|
||||
};
|
||||
// И вот это - единственный корректный способ установки значений в объект
|
||||
// конфигурации, который затем отдается в коннект и корректно работает
|
||||
// добро пожаловать в мир ява-разработчиков от IBM !
|
||||
clientConfig.groupConfig.name = 'superadmin';
|
||||
clientConfig.groupConfig.password = 'dev-pass';
|
||||
clientConfig.networkConfig.addresses.push('127.0.0.1:5701');
|
||||
|
||||
const config = new Haz.Config.ClientConfig(cfg);
|
||||
|
||||
Haz.Client.newHazelcastClient(config).then((client) => {
|
||||
console.log('Success!', client);
|
||||
console.log(clientConfig);
|
||||
|
||||
|
||||
Haz.Client.newHazelcastClient(clientConfig).then((client) => {
|
||||
console.log('Success!');
|
||||
globalClient = client;
|
||||
console.log(globalClient.getLocalEndpoint());
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user