
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@level-two/kafka
Advanced tools
A message broker extension for LevelTwo. Refer to the Worker API for function definitions.
import { createLevelTwoKafka } from "@level-two/kafka";
// Integrates RabbitMQ message broker into a LevelTwo instance
const levelTwo = createLevelTwoKafka({
topic: "level-two-broadcast",
clientOptions: {
brokers: ["localhost:9092"],
},
});
// Create a worker for getting cacheable customer objects
const worker = levelTwo.createWorker("customer", async (ids, earlyWrite) => {
const rows = await mysql.query(
"SELECT id, name FROM customers WHERE id IN (?)",
[ids]
);
rows.forEach((row) => earlyWrite(row.id, row));
});
// Service method for getting a single customer
export async function getCustomer(id: string): Promise<Customer> {
return await worker.get(id);
}
// Service method for getting a list of customers
export async function getCustomerList(ids: string[]): Promise<Customer[]> {
return await worker.getMulti(ids);
}
topic
Topic name for sending/receiving actions
clientOptions
Kafka client options
consumerOptions
Consumer connection options
producerOptions
Producer connection options
remoteCache
LevelTwo remote cache extension
cacheDefaults
LevelTwo worker cache defaults
v2.0.0
Starting with version 2.0.0
: Iterable, peek
, peekMulti
, values
, entries
, forEach
all return CachedEntry
wrapped result values instead of the ResultValue
directly.
Switching to a wrapped CachedEntry
will allow for current and future expansion on utilities for metric tracking of entries.
FAQs
Kafka broadcast extension for LevelTwo
The npm package @level-two/kafka receives a total of 2 weekly downloads. As such, @level-two/kafka popularity was classified as not popular.
We found that @level-two/kafka demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.