Actions2
Publish
AI-generatedOverview
This node publishes messages to a NATS JetStream server. It is useful for sending data or notifications to other services or applications that subscribe to the JetStream subject. For example, it can be used to publish event notifications, log messages, or data updates in real-time.
Use Case Examples
- Publishing a JSON string message to a specific subject for real-time processing by other services.
- Sending binary data as a payload to JetStream subscribers, such as files or images.
Properties
| Name | Meaning |
|---|---|
| Subject | The subject (topic) to which the message will be published. This is required to route the message correctly. |
| Payload Content Type | Specifies whether the payload is a plain string or binary data from n8n's binary data storage. |
| Payload | The actual message content to publish when the content type is string. |
| Payload Binary Property Name | The property name in the binary data where the payload is stored, used when content type is binary data. |
| Headers | Optional HTTP headers to include with the published message, specified as key-value pairs. |
Output
JSON
subject- The subject to which the message was published.payload- The content of the published message, either string or binary data reference.headers- Any headers included with the published message.
Dependencies
- Requires connection to a NATS JetStream server with appropriate credentials for authentication.
Troubleshooting
- Ensure the subject is provided and correctly formatted; missing or invalid subjects will cause publishing to fail.
- If using binary data, verify the binary property name exists and contains valid data.
- Check network connectivity and authentication credentials to the NATS JetStream server.
- Common errors include connection failures, permission denied errors, and invalid payload formats. Verify credentials and payload content to resolve these.