-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Create and close the publisher
const publisher = await connection.createPublisher({ exchange: { name: "foo", key: "bar" }})
await publisher.close()Publish a message and check the outcome
const message = createAmqpMessage({ body: "Hello World" })
const publishResult = await publisher.publish(message)
switch (publishResult.OutcomeState) {
case OutcomeState.ACCEPTED:
# the broker accepted (confirmed) the message
case OutcomeState.RELEASED:
# the broker could not route the message anywhere
case OutcomeState.REJECTED:
# at least one queue rejected the message
}Create the publisher that can publish on a queue
const publisher = await connection.createPublisher({ queue: { name: "foo" }})The publisher can also be created without a target, and then it will have to publish targeted messages
const publisher = await connection.createPublisher()
const message = createAmqpMessage({ body: "Hello World", destination: { exchange: { name: "foo", key: "bar" }}})
\\ or
const message = createAmqpMessage({ body: "Hello World", destination: { queue: { name: "foo" }}})
await publisher.publish(message)Metadata
Metadata
Assignees
Labels
No labels