{"_id":"@alt-javascript/camel-lite-component-master","_rev":"3-c794fb5c58b095f4ed843528f630799c","name":"@alt-javascript/camel-lite-component-master","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.2":{"name":"@alt-javascript/camel-lite-component-master","version":"1.0.2","keywords":["alt-javascript","camel","camel-lite","eai","eip","integration","master","leader-election","clustering","component"],"author":{"name":"Craig Parravicini"},"_id":"@alt-javascript/camel-lite-component-master@1.0.2","maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"contributors":[{"url":"Anthropic","name":"Claude"},{"name":"Apache Camel — design inspiration and pattern source"}],"homepage":"https://github.com/alt-javascript/camel-lite#readme","bugs":{"url":"https://github.com/alt-javascript/camel-lite/issues"},"dist":{"shasum":"afbef54846a7c595e9eb183313df3bb353ba40fc","tarball":"https://registry.npmjs.org/@alt-javascript/camel-lite-component-master/-/camel-lite-component-master-1.0.2.tgz","fileCount":13,"integrity":"sha512-cvJ+cZSqdSrVLonWNs6zhYQbdZE9e86cN2UedbtTKWdGi8aQm09ZfvVSZNNHJoNxEhbK8dWHq2fiuLyzvW/LIw==","signatures":[{"sig":"MEUCIQCkMXj9/G0uLd3DVoFUot9M/RZvfNODuDIqg0K9mAmaQAIgFzptuKuPyUp0eqUQiuKTJizIPMIfpJO05ZqrddRk5mM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alt-javascript%2fcamel-lite-component-master@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":35587},"type":"module","exports":{".":"./src/index.js"},"gitHead":"9f948b9f02d85c9f593229684c475cd209369f2c","scripts":{"test":"node --test"},"_npmUser":{"name":"craigparra","email":"craigparra@gmail.com"},"repository":{"url":"git+https://github.com/alt-javascript/camel-lite.git","type":"git"},"_npmVersion":"11.9.0","description":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)","directories":{},"_nodeVersion":"24.14.0","dependencies":{"node-zookeeper-client":"^1.1.3","@alt-javascript/common":"^3.0.7","@alt-javascript/config":"^3.0.7","@alt-javascript/logger":"^3.0.7","@alt-javascript/camel-lite-core":"1.0.2"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/camel-lite-component-master_1.0.2_1774595615563_0.6307885003357854","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@alt-javascript/camel-lite-component-master","version":"1.1.0","keywords":["alt-javascript","camel","camel-lite","eai","eip","integration","master","leader-election","clustering","component"],"author":{"name":"Craig Parravicini"},"_id":"@alt-javascript/camel-lite-component-master@1.1.0","maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"contributors":[{"url":"Anthropic","name":"Claude"}],"homepage":"https://github.com/alt-javascript/camel-lite#readme","bugs":{"url":"https://github.com/alt-javascript/camel-lite/issues"},"dist":{"shasum":"3d9f181bba25e3adbedff86abe1e3c1b06661530","tarball":"https://registry.npmjs.org/@alt-javascript/camel-lite-component-master/-/camel-lite-component-master-1.1.0.tgz","fileCount":13,"integrity":"sha512-EQjUSwv2bLxGQAkrZGKiJah35tGR2ScEQz6raOkteL9BpbJHw1U3sTzOSSfUDO85SlMSsY78+kKNaaEut0eU/A==","signatures":[{"sig":"MEQCIFHmbq/7d2gdFv8GTEReHRIT+mvnnldRSjNdqtkcOx5IAiAZXnCRqdHdlViknCRXW12pNQ4/QOz71yG9//FaIiQicQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alt-javascript%2fcamel-lite-component-master@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":35525},"type":"module","exports":{".":"./src/index.js"},"gitHead":"c227a03632d4b1e2f93b4562c7e74f52ba87d340","scripts":{"test":"node --test"},"_npmUser":{"name":"craigparra","email":"craigparra@gmail.com"},"repository":{"url":"git+https://github.com/alt-javascript/camel-lite.git","type":"git"},"_npmVersion":"11.9.0","description":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)","directories":{},"_nodeVersion":"24.14.0","dependencies":{"node-zookeeper-client":"^1.1.3","@alt-javascript/common":"^3.0.7","@alt-javascript/config":"^3.0.7","@alt-javascript/logger":"^3.0.7","@alt-javascript/camel-lite-core":"1.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/camel-lite-component-master_1.1.0_1774763517462_0.9709521207628748","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@alt-javascript/camel-lite-component-master","version":"1.1.1","type":"module","exports":{".":"./src/index.js"},"dependencies":{"@alt-javascript/common":"^3.0.7","@alt-javascript/config":"^3.0.7","@alt-javascript/logger":"^3.0.7","node-zookeeper-client":"^1.1.3","@alt-javascript/camel-lite-core":"1.1.1"},"scripts":{"test":"node --test"},"repository":{"type":"git","url":"git+https://github.com/alt-javascript/camel-lite.git"},"author":{"name":"Craig Parravicini"},"contributors":[{"name":"Claude","url":"Anthropic"}],"keywords":["alt-javascript","camel","camel-lite","eai","eip","integration","master","leader-election","clustering","component"],"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"gitHead":"ff8501eed381d38ac20f56aea721274466d64212","_id":"@alt-javascript/camel-lite-component-master@1.1.1","description":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)","bugs":{"url":"https://github.com/alt-javascript/camel-lite/issues"},"homepage":"https://github.com/alt-javascript/camel-lite#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-mAOdOIkhC6AMMlf5xhj40VljYjyCVCss6FT/AeWIrrDtIabKsAhpu4l5qqOr+iD6/9ArVeV06KMcjkSoH7m6gQ==","shasum":"8994f7eedf36b6141ce5787ca25fbb34aa043014","tarball":"https://registry.npmjs.org/@alt-javascript/camel-lite-component-master/-/camel-lite-component-master-1.1.1.tgz","fileCount":13,"unpackedSize":35525,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@alt-javascript%2fcamel-lite-component-master@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCIlwhUX4qh+ka0POv7Oq8/7tHN20fRy2V7+4lGFa/kMAIhAJXUyTVi6M/cVcvDIgavvqZkrQEAWZIRgBEnyB5BYNw5"}]},"_npmUser":{"name":"craigparra","email":"craigparra@gmail.com"},"directories":{},"maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/camel-lite-component-master_1.1.1_1774764470289_0.5733081660001016"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-27T07:13:33.883Z","modified":"2026-03-29T06:07:50.749Z","1.0.2":"2026-03-27T07:13:35.723Z","1.1.0":"2026-03-29T05:51:57.594Z","1.1.1":"2026-03-29T06:07:50.428Z"},"bugs":{"url":"https://github.com/alt-javascript/camel-lite/issues"},"author":{"name":"Craig Parravicini"},"homepage":"https://github.com/alt-javascript/camel-lite#readme","keywords":["alt-javascript","camel","camel-lite","eai","eip","integration","master","leader-election","clustering","component"],"repository":{"type":"git","url":"git+https://github.com/alt-javascript/camel-lite.git"},"description":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)","contributors":[{"name":"Claude","url":"Anthropic"}],"maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## What\n\nLeader election with pluggable lock-strategy backends. Only the elected leader receives exchanges — all non-leader nodes are suppressed. Headers indicate whether the current node holds the lease.\n\n## Install\n\n```sh\nnpm install camel-lite-component-master\n```\n\n## URI Syntax\n\n```\nmaster:serviceName[?backend=file&pollInterval=2000&renewInterval=5000]\n```\n\n| Parameter       | Default | Description |\n|-----------------|---------|-------------|\n| `backend`       | `file`  | Lock strategy backend: `file`, `zookeeper`, or `consul`. |\n| `pollInterval`  | `2000`  | How often (ms) a non-leader polls to acquire the lock. |\n| `renewInterval` | `5000`  | How often (ms) the current leader renews its lease. |\n\n### Backend Parameters\n\n| Backend      | Parameter         | Default              | Notes |\n|--------------|-------------------|----------------------|-------|\n| `file`       | `lockDir`         | `os.tmpdir()`        | Advisory file lock via `O_EXCL`. **Not safe on NFS shares** — use `zookeeper` or `consul` in distributed deployments. |\n| `zookeeper`  | `hosts`           | `localhost:2181`     | Ephemeral ZooKeeper node; lock auto-released on session expiry. |\n|              | `sessionTimeout`  | `30000`              | |\n| `consul`     | `host`            | `localhost`          | Session + KV acquire via native `fetch`. |\n|              | `port`            | `8500`               | |\n|              | `ttl`             | `15s`                | Consul session TTL string (e.g. `15s`, `30s`). |\n\n### Headers Set on Each Exchange\n\n| Header                  | Type      | Description |\n|-------------------------|-----------|-------------|\n| `CamelMasterIsLeader`   | `boolean` | `true` if this node currently holds the lock. |\n| `CamelMasterService`    | `string`  | The service name from the URI. |\n| `CamelMasterNodeId`     | `string`  | Unique node identifier for this process. |\n\n## Usage\n\n```js\nimport { CamelContext } from 'camel-lite-core';\nimport { MasterComponent } from 'camel-lite-component-master';\nimport { TimerComponent } from 'camel-lite-component-timer';\n\nconst context = new CamelContext();\ncontext.addComponent('master', new MasterComponent());\ncontext.addComponent('timer', new TimerComponent());\n\ncontext.addRoutes({\n  configure(ctx) {\n    ctx.from('master:myApp?backend=file&pollInterval=2000')\n      .process(exchange => {\n        if (exchange.in.getHeader('CamelMasterIsLeader')) {\n          console.log('I am the leader — doing leader work');\n        }\n        // Non-leader nodes reach here with CamelMasterIsLeader = false\n        // and an empty body; typically filter them out.\n      });\n  }\n});\n\nawait context.start();\n```\n\n## See Also\n\n[camel-lite — root README](../../README.md)\n","readmeFilename":"README.md"}