Skip to main content

Message Queue Consumer

The Message Queue Consumer allows your application to listen to the message queue and receive data from message queue middleware such as Kafka.

Manifest Definition

modules:
messageQueueConsumer:
- key: mq-queue-consumer
# Name of the queue for which this consumer will be invoked
queue: queue-name
# The source of the message, corresponding to the messageQueues below
messageQueue: bcc-kafka
# Optional, for transforming the message body data
messageTransformer:
tenant: $.tenant
data:
name: $.name
resolver:
function: consumer-function
method: event-listener
function:
- key: consumer-function
handler: consumer.handler

messageQueues:
- key: bcc-kafka
type: kafka
endpoint: gitee-kafka:9092

Parameter Explanation

  • The messageQueues module defines the type and address of the message queue. It matches the messageQueue in messageQueueConsumer through the key.
  • messageTransformer is used to transform Kafka message data, and it needs to have tenant and data fields.
  • The function in resolver points to the corresponding Key in the function module, and the method in resolver corresponds to the method defined in the execution function. Please refer toresolver.