Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@epsor/consumer-wrapper
Advanced tools
@epsor/consumer-wrapper
It wrap the consumer connection to kafka, redis connexion, mongodb connexion to help you to develop new consumer faster.
@epsor/consumer-wrapper
assumes that a few environment variables are set:
EVENT_TOPIC
- The event topic to consumeMONGODB_URL
- The mongoDB server urlREDIS_URL
- The redis server urlKAFKA_HOST
- The kafka server info IP:PORTKAFKA_GROUP_ID
- The kafka group idThis package comes with AbstractHandler
which is supposed to be extanded by your consumers handler.
Here an example of a handler:
import { MongoDuplicateEntryError } from '@epsor/mongodb-wrapper';
class UserCreateHandler extends AbstractHandler {
/** @inheritdoc */
static get handlerName() {
return 'UserCreate';
}
/** @inheritdoc */
static get allowedTypes() {
return ['user.created'];
}
/** @inheritdoc */
static async handle({ mongo }, userCreatedDto) {
const users = await mongo.collection('users');
try {
await users.insertOne(userCreatedDto.fields);
} catch (err) {
if (err instanceof MongoDuplicateEntryError) {
// An error occurred
}
}
}
}
import { Consumer } from '@epsor/consumer-wrapper';
/** @type {AbstractHandler[]} */
import handlers from './handlers';
(async () => {
const consumer = new Consumer('b2c', handlers);
await consumer.initDependencies();
await consumer.createCollections('users');
await consumer.run();
})();
This package contains an express api endpoint to check pod's health.
npm start
to start the server.http://localhost:{HEALTHCHECK_PORT}/.well-known/express/server-health
. Default port is 8000
please look at the README.md of epsor-v2 to get the list of supported ports for every consumers.
FAQs
Event consumer
We found that @epsor/consumer-wrapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 26 open source maintainers 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.