# @blued-core-oversea/kafka-client

> 基于 kafka-node 的一层封装。

Latest version **1.0.0** (published 2024-12-17) · ISC license · 0 weekly downloads

## Install

```sh
npm install @blued-core-oversea/kafka-client
pnpm add @blued-core-oversea/kafka-client
yarn add @blued-core-oversea/kafka-client
bun add @blued-core-oversea/kafka-client
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-12-17 |
| First published | 2021-08-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 14.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | bluediapp |

## Links

- npm: https://www.npmjs.com/package/@blued-core-oversea/kafka-client
- npm.io page: https://npm.io/package/@blued-core-oversea/kafka-client

## Dependencies (2)

- [node-qconf](https://npm.io/package/node-qconf.md) ^0.4.2
- [node-rdkafka](https://npm.io/package/node-rdkafka.md) ^3.2.1

## Recent versions

- 1.0.0 (latest) — 2024-12-17
- 0.0.2 — 2023-07-07
- 0.0.1 — 2021-08-21

## README

基于 kafka-node 的一层封装。

```bash
npm i @blued-core-oversea/kafka-client
```

```typescript
import { KafkaClient } from '../index'

const kafka = {
  oversea: '/blued/backend/ukafka/oversea_app/bootstrap',
}

const kafkaClient = new KafkaClient(kafka)
export const liveLogKafkaClient = () => kafkaClient.getClient('oversea')

const testData = { timestamp: 1629460128, data: { uid: 90000024, extra: { event: 15, targetUid: 90000024, liveId: 0, taskLevel: '4', taskId: '8' } }, app: 2 }

export const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms))

const main = async () => {
  await sleep(1000)
  liveLogKafkaClient().send('xxxxxxx', JSON.stringify(testData))
  console.log('---------------over')
}

main().then(() => {
  kafkaClient.close()
  console.log('success')
}).catch(error => {
  console.log(error)
})
```

---
_Source: https://npm.io/package/@blued-core-oversea/kafka-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
