
Product
Announcing Bun and vlt Support in Socket
Bringing supply chain security to the next generation of JavaScript package managers
@aggregion/blockchain-mq
Advanced tools
const keySource = new MockKeySource();
const dataSource = new MockDataSource<string>();
const bmq = new BlockchainMQ({
keySource,
dataSource,
ownKey: await keySource.getMyKey('my_org_id'),
pollingInterval: 1000,
});
const topic = 56; // Some topic number
// Listening for new messages
const emitter = await bmq.poll<string>(topic);
let lastCursor;
emitter.on('message', (message) => {
console.log(message);
});
emitter.on('newCursor', (cursor) => {
lastCursor = cursor; // In production, you must save cursor and resume from this another time you need polling
});
await bmq.send<string>(
topic, // Topic number
'Hello!',
'some_receiver_org_id',
);
// Broadcast message
await bmq.send<string>(
topic,
'Hello!'
);
emitter.stop(); // Stop polling
bmq.stopAll(); // You can use this method instead of calling "stop" of each emitter
To use with the real blockchain, create client instance as follows (also look at blockchainMQ.e2e-spec.ts for example):
import { AggregionBlockchain } from '@aggregion/dmp-contracts';
const client = new AggregionBlockchain(nodeUrl, [
pair1.privateKey,
pair2.privateKey,
]);
const blockchainMQ = new BlockchainMQ({
keySource: new EosKeySource({
contractName: 'dmpusers',
client: client,
}),
dataSource: new EosDataSource({
contractName: 'dmpusers',
client: client,
clientAccount: 'your_orgId', // Id of your organization in orgsv2 table
}),
ownKey: {
orgId: 'your_orgId',// Id of your organization in orgsv2 table
data: 'your organization private key', // Not blockchain key! It is private part of public key saved in orgsv2 table
format: KeyFormat.PKCS1_PEM,
algo: KeyAlgo.RSA_4096,
},
pollingInterval: 500,
});
FAQs
Blockchain message queue module
We found that @aggregion/blockchain-mq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.

Product
Bringing supply chain security to the next generation of JavaScript package managers

Product
A safer, faster way to eliminate vulnerabilities without updating dependencies

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.