New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

smqp

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smqp - npm Package Compare versions

Comparing version 1.11.1 to 2.0.0

8

CHANGELOG.md
Changelog
=========
# 2.0.0
## Breaking changes
- `createShovel` has changed signature: last argument `cloneMessage` is converted to an `args` object, and `cloneMessage` moved to a property of `args`
## Additions
- Introduce e2e by `bindExchange` and consequentaly `unbindExchange`, shoveling messages between exchanges
# 1.11.1

@@ -5,0 +13,0 @@

33

dist/src/Broker.js

@@ -253,5 +253,34 @@ "use strict";

function bindExchange() {}
function bindExchange(source, destination, pattern = '#', args = {}) {
const name = `e2e-${source}2${destination}-${pattern}`;
const {
consumerTag,
on: onShovel,
close: onClose,
source: shovelSource
} = createShovel(name, {
broker,
exchange: source,
pattern,
consumerTag: `smq.ctag-${name}`
}, {
broker,
exchange: destination
}, { ...args
});
return {
name,
source,
destination,
queue: shovelSource.queue,
consumerTag,
on: onShovel,
close: onClose
};
}
function unbindExchange() {}
function unbindExchange(source, destination, pattern = '#') {
const name = `e2e-${source}2${destination}-${pattern}`;
return closeShovel(name);
}

@@ -258,0 +287,0 @@ function publish(exchangeName, routingKey, content, options) {

16

dist/src/Shovel.js

@@ -10,3 +10,3 @@ "use strict";

function Shovel(name, source, destination, cloneMessage) {
function Shovel(name, source, destination, options = {}) {
const {

@@ -22,2 +22,5 @@ broker: sourceBroker,

} = destination;
const {
cloneMessage
} = options;
const sourceExchange = sourceBroker.getExchange(sourceExchangeName);

@@ -35,3 +38,4 @@

const consumerTag = `smq.shoveltag-${name}`;
const sameBroker = sourceBroker === destinationBroker;
const consumerTag = source.consumerTag || `smq.shoveltag-${name}`;
const routingKeyPattern = pattern || '#';

@@ -77,5 +81,7 @@ const events = (0, _Exchange.EventExchange)();

} = messageHandler(message);
destinationExchange.publish(routingKey, content, { ...properties,
'shovel-name': name
});
const props = { ...properties,
'source-exchange': sourceExchangeName
};
if (!sameBroker) props['shovel-name'] = name;
destinationExchange.publish(routingKey, content, props);
message.ack();

@@ -82,0 +88,0 @@ }

{
"name": "smqp",
"version": "1.11.1",
"version": "2.0.0",
"description": "Synchronous message queuing package",

@@ -55,3 +55,4 @@ "author": {

"topic",
"direct"
"direct",
"shovel"
],

@@ -58,0 +59,0 @@ "devDependencies": {

@@ -238,5 +238,32 @@ import {Exchange, EventExchange} from './Exchange';

function bindExchange() {}
function unbindExchange() {}
function bindExchange(source, destination, pattern = '#', args = {}) {
const name = `e2e-${source}2${destination}-${pattern}`;
const {consumerTag, on: onShovel, close: onClose, source: shovelSource} = createShovel(name, {
broker,
exchange: source,
pattern,
consumerTag: `smq.ctag-${name}`,
}, {
broker,
exchange: destination
}, {
...args
});
return {
name,
source,
destination,
queue: shovelSource.queue,
consumerTag,
on: onShovel,
close: onClose,
};
}
function unbindExchange(source, destination, pattern = '#') {
const name = `e2e-${source}2${destination}-${pattern}`;
return closeShovel(name);
}
function publish(exchangeName, routingKey, content, options) {

@@ -243,0 +270,0 @@ const exchange = getExchangeByName(exchangeName);

import {EventExchange} from './Exchange';
export function Shovel(name, source, destination, cloneMessage) {
export function Shovel(name, source, destination, options = {}) {
const {broker: sourceBroker, exchange: sourceExchangeName, pattern, queue} = source;
const {broker: destinationBroker, exchange: destinationExchangeName} = destination;
const {cloneMessage} = options;

@@ -17,3 +18,4 @@ const sourceExchange = sourceBroker.getExchange(sourceExchangeName);

const consumerTag = `smq.shoveltag-${name}`;
const sameBroker = sourceBroker === destinationBroker;
const consumerTag = source.consumerTag || `smq.shoveltag-${name}`;
const routingKeyPattern = pattern || '#';

@@ -55,3 +57,5 @@ const events = EventExchange();

const {content, properties} = messageHandler(message);
destinationExchange.publish(routingKey, content, {...properties, 'shovel-name': name});
const props = {...properties, 'source-exchange': sourceExchangeName};
if (!sameBroker) props['shovel-name'] = name;
destinationExchange.publish(routingKey, content, props);
message.ack();

@@ -58,0 +62,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc