1.2.4 • Published 1 year ago
@zeroq/amqp-wrapper v1.2.4
ZeroQ AMPQ wrapper
Usage
import * as broker from "@zeroq/amqp-wrapper"
//first connect to amqp server (rabbitmq)
await broker.connect(
connString,
{
name: "offices", //exchange name
type: "topic" //exchange type
},
true, //if true create a channel for subscribers
true, //if true create a channel for publisher
)
//if createChannelSubsriber is true, then you can add subscribers
const subscriber = await broker.addSubscriber(
"queue_name",
"#.route.key",
{
name: "offices", //exchange name
type: "topic" //exchange type
},
);
//now you can listen messages
attentionsSubscriber.listen(async (content) => {
// the listen function do the ack() or nack() when is an error
//use the try/catch block
try{
//do your logic here
}catch (e) {
throw e
}
})
//to publish messages it's required createPublisherChannel in true in connect function
await broker.publish(
'zeroq.route.key', //check this link to review the routink key format https://www.notion.so/zeroq/Formato-de-colas-y-routing-keys-de-broker-1669f3dd032c4717817395074e48c4f3#719d4f95e78e4e49a82b923670c1be30
{
key:"data"
} //an object with the message to send
)
1.2.4
1 year ago
1.2.3
1 year ago
1.2.0
3 years ago
1.1.1
3 years ago
1.0.19
3 years ago
1.0.2
3 years ago
1.1.0
3 years ago
1.0.18
3 years ago
1.0.1
3 years ago
1.0.17
3 years ago
1.0.0
3 years ago
1.0.16
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.2.2
3 years ago
1.1.3
3 years ago
1.0.4
3 years ago
1.2.1
3 years ago
1.1.2
3 years ago
1.0.3
3 years ago
0.0.52
3 years ago
0.0.53
3 years ago
0.0.54
3 years ago
0.0.55
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
0.0.51
4 years ago
0.0.50
4 years ago