Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function MockBroker (name) {
this.name = name;
this.objects = [];
this.container = rhea.create_container({id:this.name});
this.container.on('message', this.on_message.bind(this));
var self = this;
this.container.on('connection_open', function (context) {
self.emit('connected', context);
});
this.container.on('connection_close', function (context) {
self.emit('disconnected', context);
});
this.container.on('sender_open', function(context) {
if (context.sender.source.dynamic) {
var id = self.container.generate_uuid();
context.sender.set_source({address:id});
} else {
context.sender.set_source({address:context.sender.remote.attach.source.address});
}
});
beforeEach(function(done) {
container = rhea.create_container();
done();
});
Router.prototype['delete_' + name] = function (o) {
return this.delete_entity(resource_type, o.name);
};
var plural_name = plural || name + 's';
Router.prototype['get_' + plural_name] = function (options) {
return this.query(resource_type, options);
};
}
add_resource_type('connector');
add_resource_type('listener');
add_resource_type('address', 'org.apache.qpid.dispatch.router.config.address', 'addresses');
add_resource_type('link_route', 'org.apache.qpid.dispatch.router.config.linkRoute');
var amqp = require('rhea').create_container();
module.exports.Router = Router;
module.exports.connect = function (options) {
return new Router(amqp.connect(options));
}
BrokerController.prototype.connect = function (options) {
this.excluded_types = type_filter(['subscription']);
var container = rhea.create_container();
container.on('connection_open', this.on_connection_open.bind(this));
return container.connect(options);
};
function Ragent() {
this.known_routers = {};
this.connected_routers = {};
this.connected_brokers = {};
this.addresses = [];
this.subscribers = {};
this.clients = {};
this.container = amqp.create_container();
this.container.sasl_server_mechanisms.enable_anonymous();
this.configure_handlers();
this.status = new events.EventEmitter();
this.disable_connectivity = false;
}
Artemis.prototype.findConnectorService = function (name) {
return this.getConnectorServices().then(
function (results) {
return results.indexOf(name) >= 0;
}
);
};
Artemis.prototype.close = function () {
if (this.connection) {
this.connection.close();
}
}
var amqp = require('rhea').create_container();
module.exports.Artemis = Artemis;
module.exports.connect = function (options) {
return new Artemis(amqp.connect(options));
}
Subscription.prototype.subscribe = function (selector, handler) {
var self = this;
this.selector = selector;
var amqp = rhea.create_container();
amqp.on('message', handler);
var conn = config_service.connect(amqp, "podsense-" + selector.cluster_id);
if (conn) {
conn.open_receiver({source:{address:"podsense", filter:{"labels": {"role": "broker"}, "annotations": selector}}});
this.conn = conn;
}
}
var resource_type = typename || name;
Router.prototype['get_' + name] = function (options) {
return this.query(resource_type, options);
};
}
add_resource_type('connector');
add_resource_type('listener');
add_resource_type('address', 'org.apache.qpid.dispatch.router.config.address', 'addresses');
add_resource_type('link_route', 'org.apache.qpid.dispatch.router.config.linkRoute');
add_queryable_type('connections', 'org.apache.qpid.dispatch.connection');
add_queryable_type('links', 'org.apache.qpid.dispatch.router.link');
add_queryable_type('address_stats', 'org.apache.qpid.dispatch.router.address');
var amqp = require('rhea').create_container();
module.exports.Router = Router;
module.exports.connect = function (options) {
return new Router(amqp.connect(options));
}
this.addresses.on('updated', function (address) {
self.publish({subject:'address',body:address});
});
this.addresses.on('deleted', function (address) {
log.debug('address %s has been deleted, notifying clients...', address.address);
self.publish({subject:'address_deleted',body:address.address});
});
this.connections.on('updated', function (conn) {
self.publish({subject:'connection',body:conn});
});
this.connections.on('deleted', function (conn) {
log.debug('connection %s has been deleted, notifying clients...', conn.host);
self.publish({subject:'connection_deleted',body:conn.id});
});
this.amqp_container = rhea.create_container({autoaccept:false});
this.amqp_container.on('sender_open', function (context) {
self.subscribe(context.connection.remote.open.container_id, context.sender);
});
function unsubscribe (context) {
if (context.connection.remote.open) {
self.unsubscribe(context.connection.remote.open.container_id);
}
}
this.amqp_container.on('sender_close', unsubscribe);
this.amqp_container.on('connection_close', unsubscribe);
this.amqp_container.on('disconnected', unsubscribe);
this.amqp_container.on('message', function (context) {
var accept = function () {
log.info('%s request succeeded', context.message.subject);
context.delivery.accept();
this.addresses.on('deleted', function (address) {
log.debug('address %s has been deleted, notifying clients...', address.address);
self.publish({subject:'address_deleted',body:address.address});
});
this.addresses.on('purged', function (address) {
log.info('address %s has been purged, notifying clients...', address.address);
self.publish({subject:'address_purged',body:address.address});
});
this.connections.on('updated', function (conn) {
self.publish({subject:'connection',body:conn});
});
this.connections.on('deleted', function (conn) {
log.debug('connection %s has been deleted, notifying clients...', conn.host);
self.publish({subject:'connection_deleted',body:conn.id});
});
this.amqp_container = rhea.create_container({autoaccept:false});
this.amqp_container.on('sender_open', function (context) {
self.subscribe(context.connection.remote.open.container_id, context.sender);
});
function unsubscribe (context) {
if (context.connection.remote.open) {
self.unsubscribe(context.connection.remote.open.container_id);
}
}
this.amqp_container.on('sender_close', unsubscribe);
this.amqp_container.on('connection_close', unsubscribe);
this.amqp_container.on('disconnected', unsubscribe);
this.amqp_container.on('message', function (context) {
var accept = function () {
log.info('%s request succeeded', context.message.subject);
context.delivery.accept();