Merge pull request #21542 from weeco/amqplib-connection-object-fix

Accept a connection object instead of a URL
This commit is contained in:
Benjamin Lichtman
2017-11-21 13:09:02 -08:00
committed by GitHub
2 changed files with 60 additions and 2 deletions
+1 -1
View File
@@ -63,4 +63,4 @@ export interface ConfirmChannel extends Channel {
waitForConfirms(): Promise<void>;
}
export function connect(url: string, socketOptions?: any): Promise<Connection>;
export function connect(url: string | Options.Connect, socketOptions?: any): Promise<Connection>;
+59 -1
View File
@@ -21,6 +21,64 @@ export namespace Replies {
}
export namespace Options {
interface Connect {
/**
* The to be used protocol
*
* Default value: 'amqp'
*/
protocol?: string;
/**
* Hostname used for connecting to the server.
*
* Default value: 'localhost'
*/
hostname?: string;
/**
* Port used for connecting to the server.
*
* Default value: 5672
*/
port?: number;
/**
* Username used for authenticating against the server.
*
* Default value: 'guest'
*/
username?: string;
/**
* Password used for authenticating against the server.
*
* Default value: 'guest'
*/
password?: string;
/**
* The desired locale for error messages. RabbitMQ only ever uses en_US
*
* Default value: 'en_US'
*/
locale?: string;
/**
* The size in bytes of the maximum frame allowed over the connection. 0 means
* no limit (but since frames have a size field which is an unsigned 32 bit integer, it’s perforce 2^32 - 1).
*
* Default value: 0x1000 (4kb) - That's the allowed minimum, it will fit many purposes
*/
frameMax?: number;
/**
* The period of the connection heartbeat in seconds.
*
* Default value: 0
*/
heartbeat?: number;
/**
* What VHost shall be used.
*
* Default value: '/'
*/
vhost?: string;
}
interface AssertQueue {
exclusive?: boolean;
durable?: boolean;
@@ -85,4 +143,4 @@ export interface Message {
content: Buffer;
fields: any;
properties: any;
}
}