Rabbitmq Endpoint
Rabbitmq Endpoint v0.24.0+ Used to create and start the Rabbitmq subscription service, which can subscribe to data from different stream names and then route it to different rule chains for processing.
TIP
- This component is an extension component and requires the introduction of additional extension libraries: rulego-components (opens new window)
# Type
endpoint/rabbitmq
# Startup Configuration
This component allows the reuse of shared connection clients through the server
field. See Component Connection Reuse for reference.
Field | Type | Description | Default |
---|---|---|---|
server | string | RabbitMQ server address, example: amqp://guest:guest@127.0.0.1:5672/ | None |
exchange | string | Exchange name | None |
exchangeType | string | Exchange type, available values: direct, fanout, topic | None |
durable | bool | Indicates whether the exchange is durable. If set to true, the exchange will be preserved even if the message server is restarted. | false |
autoDelete | bool | Indicates whether the exchange is automatically deleted. If set to true, the exchange will be automatically deleted when there are no bound queues. | false |
# Response
Before responding with exchange.Out.SetBody
, you need to specify the responseTopic
parameter through exchange.Out.Headers()
or exchange.Out.Msg.Metadata
, and the component will send data to the specified topic:
exchange.Out.GetMsg().Metadata.PutValue("responseTopic", "device.msg.response")
// or
exchange.Out.Headers().Add("responseTopic", "device.msg.response")
exchange.Out.SetBody([]byte("ok"))
1
2
3
4
5
2
3
4
5
Response parameter configuration:
Field | Type | Required | Description | Default |
---|---|---|---|---|
responseTopic/responseKey | string | Yes | Response Key | - |
responseExchange | string | Yes | Response Exchange | - |
# Example
Below is an example code using the endpoint:
Edit this page on GitHub (opens new window)
Last Updated: 2024/10/23, 10:13:01