Skip to content

Commit

Permalink
Merge pull request #292 from skadefro/master
Browse files Browse the repository at this point in the history
quick fix, not parsing exchange name proberly
  • Loading branch information
skadefro authored Jan 16, 2024
2 parents 3f45113 + ce02025 commit e384be2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions OpenFlow/src/amqpwrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,21 +392,23 @@ export class amqpwrapper extends events.EventEmitter {
if(exchange.name == "openflow") {
return
}
var exchangename = exchange;
if(exchange.name != null) exchangename = exchange.name;
// @ts-ignore
let { algorithm, routingkey, exclusive } = exchange;
if(algorithm == null || algorithm == "") algorithm = "fanout"
if(routingkey == null || routingkey == "") routingkey = ""
if(exclusive == null || exclusive == "") exclusive = true
const AssertExchangeOptions: any = Object.assign({}, (amqpwrapper.Instance().AssertExchangeOptions));
AssertExchangeOptions.exclusive = exclusive;
// if (exchange.name != Config.amqp_dlx && exchange.name != "openflow" && exchange.name != "openflow_logs") AssertExchangeOptions.autoDelete = true;
// if (exchangename != Config.amqp_dlx && exchangename != "openflow" && exchangename != "openflow_logs") AssertExchangeOptions.autoDelete = true;
AssertExchangeOptions.autoDelete = false;

// try and create exchange
if(! await this.PreAssertExchange(exchange.name, algorithm, AssertExchangeOptions)) {
if(! await this.PreAssertExchange(exchangename, algorithm, AssertExchangeOptions)) {
// config differs, so delete and recreate
await this.checkAndDeleteExchange(exchange.name);
await this.PreAssertExchange(exchange.name, algorithm, AssertExchangeOptions);
await this.checkAndDeleteExchange(exchangename);
await this.PreAssertExchange(exchangename, algorithm, AssertExchangeOptions);
}
// await amqpwrapper.Instance().AddExchangeConsumer(
// Crypt.rootUser(), exchange.name, algorithm, routingkey, AssertExchangeOptions, Crypt.rootToken(), false, null, parent);
Expand All @@ -421,6 +423,7 @@ export class amqpwrapper extends events.EventEmitter {
// if (exchange != Config.amqp_dlx && exchange != "openflow" && exchange != "openflow_logs") q.ExchangeOptions.autoDelete = true;
q.ExchangeOptions.autoDelete = false;
q.exchange = exchange; q.algorithm = algorithm; q.routingkey = routingkey; q.callback = callback;
await this.PreRegisterExchange(exchange, span)
const _ok = await this.channel.assertExchange(q.exchange, q.algorithm, q.ExchangeOptions);
if (addqueue) {
let AssertQueueOptions = null;
Expand Down Expand Up @@ -542,7 +545,7 @@ export class amqpwrapper extends events.EventEmitter {
if(exchange != "openflow" && exchange != "openflow_logs") {
// console.log("publishing to exchange: " + exchange + " routingkey: " + routingkey + " correlationId: " + correlationId);
}
this.PreRegisterExchange
await this.PreRegisterExchange(exchange, span)
this.channel.publish(exchange, routingkey, Buffer.from(data), options);
}
}
Expand Down Expand Up @@ -593,6 +596,7 @@ export class amqpwrapper extends events.EventEmitter {
if(exchange != "openflow" && exchange != "openflow_logs") {
// console.log("publishing to exchange: " + exchange + " routingkey: " + routingkey + " correlationId: " + correlationId);
}
await this.PreRegisterExchange(exchange, span)
this.channel.publish(exchange, routingkey, Buffer.from(data), options);
}
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openiap/openflow",
"version": "1.5.8.14",
"version": "1.5.8.18",
"description": "Simple wrapper around NodeRed, RabbitMQ and MongoDB to support a more scaleable NodeRed implementation.\r Also the \"backend\" for [OpenRPA](https://github.com/skadefro/OpenRPA)",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e384be2

Please sign in to comment.