Azure Service Bus icon

Azure Service Bus

Send and receive messages from Azure Service Bus

Actions3

Overview

This node enables sending messages to an Azure Service Bus Topic using either the official Azure SDK or the HTTP REST API. It is designed for scenarios where you want to publish messages to a topic in Azure Service Bus, which can then be consumed by multiple subscribers. This is useful for event-driven architectures, decoupling microservices, or broadcasting notifications.

Practical examples include:

  • Sending telemetry data from IoT devices to a topic for processing.
  • Publishing order events in an e-commerce system to notify various downstream services.
  • Broadcasting alerts or notifications to multiple systems subscribed to the topic.

The node supports setting message body content, custom properties, session identifiers (for session-enabled topics), and message metadata such as content type and message ID.

Properties

Name Meaning
Protocol Protocol to use for Azure Service Bus connection:
- Azure SDK (Recommended)
- HTTP REST API (firewall-friendly)
Topic Name The name of the Azure Service Bus topic to which the message will be sent.
Message Body The content/body of the message to send.
Session ID Optional session identifier for session-enabled topics to group related messages.
Message Properties Custom key-value pairs to add as application properties on the message.
Content Type MIME type of the message content, defaulting to application/json.
Message ID Unique identifier for the message, useful for deduplication or tracking.

Output

The node outputs an array of JSON objects, one per message sent. Each object contains:

  • success: Boolean indicating if the message was sent successfully.
  • messageId: The unique identifier of the sent message (if provided).
  • topicName: The name of the topic the message was sent to.
  • sentAt: ISO timestamp string indicating when the message was sent.

Example output item:

{
  "success": true,
  "messageId": "12345",
  "topicName": "my-topic",
  "sentAt": "2024-06-01T12:00:00.000Z"
}

No binary data output is produced by this operation.

Dependencies

  • Requires an Azure Service Bus connection string credential with appropriate permissions to send messages to the specified topic.
  • Supports two protocols:
    • Azure SDK (@azure/service-bus package) — recommended for full feature support.
    • HTTP REST API — useful in environments with firewall restrictions.
  • If using the SDK protocol with WebSocket transport, requires the ws package.
  • Node-fetch is used internally for HTTP REST API calls.

Troubleshooting

  • Missing or invalid connection string: The node throws an error if the Azure Service Bus connection string is missing or contains placeholder blank values. Ensure the connection string is correctly configured in credentials.
  • Empty message body: Sending a message without a body results in an error. Always provide a non-empty message body.
  • Protocol mismatch: Topic operations only support the Azure SDK protocol. Attempting to send messages to a topic using the HTTP REST API protocol will cause an error.
  • Session errors: When specifying a session ID, ensure the topic is session-enabled. Errors accepting sessions or sending session messages may occur otherwise.
  • Network/firewall issues: Using the HTTP REST API protocol helps bypass firewall restrictions but requires correct SAS token generation and endpoint configuration.
  • Message property formatting: Custom message properties must have both key and value defined; otherwise, they are ignored.

Common error messages:

  • "Azure Service Bus connection string is required": Set valid credentials.
  • "Message Body cannot be empty": Provide message content.
  • "Topic operations are only supported with Azure SDK protocol": Switch protocol to SDK for topic operations.
  • Errors related to session acceptance indicate invalid session IDs or session timeouts.

Links and References

Discussion