Development of
typescript-amqp
takes place in branchdevelop
. Do not push to themaster
branch!
typescript-amqp
was developed to facilitate the use of the amqplib and to
avoid code duplication.
yarn add typescript-amqp
- native TypeScript support
- easy usage
- basic listener (e.g. Hello World!)
- Work queues
- Publish/Subscribe
- Routing
- Topics
- Remote procedure call (RPC)
- Publisher Confirms
Must be created once and includes the connection as well as any methods.
import { Amqp } from 'typescript-amqp'
const amqp = new Amqp();
Establishes a connection to the server.
options
-string
oramqplib.Options.Connect
- If the type is
string
, then it must be a valid amqp-url string (amqp://user:password@server
)!
- If the type is
- socketOptions - (optional)
object
returns Promise<amqplib.Connection>
Disconnects the connection to the server.
returns Promise<void>
Returns the current (existing) connection to the server.
returns amqplib.Connection | undefined
queue
-string
Name of the server queue
returns AmqpListener
queue
-string
Name of the server queue
returns AmqpListener
if queue
could be found, undefined
otherwise.
queue
-string
Name of the server queue
returns AmqpRpc
queue
-string
Name of the server queue
returns AmqpRpc
if queue
could be found, undefined
otherwise.
queue
-string
Name of the server queue
returns AmqpWorker
queue
-string
Name of the server queue
returns AmqpWorker
if queue
could be found, undefined
otherwise.
exchange
-string
Name of the server exchange
returns AmqpPublishSubscribe
exchange
-string
Name of the server exchange
returns AmqpPublishSubscribe
if exchange
could be found, undefined
otherwise.
exchange
-string
Name of the server exchange
returns AmqpRouting
exchange
-string
Name of the server exchange
returns AmqpRouting
if exchange
could be found, undefined
otherwise.
exchange
-string
Name of the server exchange
returns AmqpTopics
exchange
-string
Name of the server exchange
returns AmqpTopics
if exchange
could be found, undefined
otherwise.
callback
-ListenerServerCallback
(msg: IMessage | null) => any
returns Promise<void>
message
string
object
Buffer
returns Promise<boolean>
callback
-PublishSubscribeServerCallback
(msg: IMessage | null) => any
returns Promise<void>
message
string
object
Buffer
returns Promise<boolean>
callback
-RoutingServerCallback
(msg: IMessage | null) => any
returns Promise<void>
message
string
object
Buffer
returns Promise<boolean>
callback
-RpcServerCallback
(channel: amqplib.Channel, msg: IMessage | null) => any
returns Promise<void>
message
string
object
Buffer
returns Promise<Buffer>
severities
-string[]
callback
-TopicsServerCallback
(msg: IMessage | null) => any
returns Promise<void>
severity
-string
message
string
object
Buffer
returns Promise<boolean>
severities
-string[]
callback
-WorkerServerCallback
(channel: amqplib.Channel, msg: IMessage | null) => any
returns Promise<void>
severity
-string
message
string
object
Buffer
returns Promise<boolean>