
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
Apache pulsar plugin for egg
// https://pulsar.apache.org/docs/en/client-libraries-cpp/
// install pulsar-client-dev lib for macOS
$ brew install libpulsar
$ npm i egg-pulsar --save
// {app_root}/config/plugin.js
exports.pulsar = {
enable: true,
package: 'egg-pulsar',
};
// {app_root}/config/config.default.js
exports.pulsar = {
client: {
url: 'pulsar://localhost:6650',
options: {
operationTimeoutSeconds: 30,
},
subscribe: {
topic: 'persistent://public/default/my-topic',
subscription: 'sub1',
subscriptionType: 'Shared',
ackTimeoutMs: 10000,
listener: 'xxx', // 对应 app/subscriber/xxx
},
}
};
see apache pulsar client-libraries-node for more detail.
// {app_root}/app/controller/home.js
'use strict';
const Controller = require('egg').Controller;
class HomeController extends Controller {
async index() {
const { ctx } = this;
await this.app.pulsar.send({ now: Date.now() }, 'my-topic');
// or
await this.app.pulsar.send({ now: Date.now() }, { topic: 'my-topic' });
// or
await this.app.pulsar.send({ data: { now: Date.now() }, properties: [ 'a', 'c' ] }, { topic: 'my-topic' });
ctx.body = 'hi, egg';
}
}
module.exports = HomeController;
// {app_root}/app/subscriber/test.js
'use strict';
const debug = require('debug')('subscriber');
class TestSubscriber {
constructor(ctx) {
this.ctx = ctx;
this.app = ctx.app;
}
async consume(message) {
debug('message: %s', JSON.stringify(message));
console.log(message);
// throw ('consume message error');
}
}
module.exports = TestSubscriber;
// pulsar server run on docker
$ docker run -it \
-p 6650:6650 \
-p 8080:8080 \
--mount source=pulsardata,target=/pulsar/data \
--mount source=pulsarconf,target=/pulsar/conf \
apachepulsar/pulsar:2.7.2 \
bin/pulsar standalone
Please open an issue here.
FAQs
pulsar plugin for egg
We found that egg-pulsar 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.