To ensure that all the events on a blockchain can be automatically released to a message-oriented middleware, you can configure the mapping between the events and Message Queue (MQ). After the mapping is configured, Alibaba Cloud Blockchain as a Service (BaaS) automatically generates an MQ message and releases it to the MQ topic when a blockchain event is detected. You can subscribe to the event messages for further handling.
Note: Before you integrate Alibaba Cloud BaaS with Message Queue for Apache RocketMQ, you must install the cloud service integration module.
- Find the target organization in the My Organizations section and click Cloud service integration on the right side.
- Click the RocketMQ Message Queue tab.
- Click Condition detection to check the status of cloud service integration.
- If you have not enabled Message Queue for Apache RocketMQ, click Enable service.
- If you have not authorized Alibaba Cloud BaaS to access Message Queue for Apache RocketMQ, click Authorization Service to authorize Alibaba Cloud BaaS.
- If the following figure appears, the integration is complete. Click Add Configuration and configure an event trigger by referring to the following procedure.
Note: Before you configure a Message Queue for Apache RocketMQ trigger, you must install the cloud service integration module and integrate Alibaba Cloud BaaS with Message Queue for Apache RocketMQ.
- On the RocketMQ Message Queue tab, click Add configuration.
In the Add MQ configuration side pane that appears, set the following parameters:
- Name: the name of the trigger for easy identification.
- Channel/network: the fabric channel used by the trigger to listen to and push events.
- Event type: the type of events you want to push to an external service. For information about event types, see Subscribe to events.
- MQ domain name: the HTTP endpoint of the MQ instance.
- MQ instance name: the MQ instance ID displayed in MQ instance details.
- MQ Topic: the message topic pushed to the MQ.
- Message Tag: the message tag pushed to the MQ, which is optional.
- Failure threshold: Advanced option. After the number of failure exceeds this value, the trigger enters the failed state and stops processing. -1 means the number of failure is unlimited, and the trigger will not enter the failed state.
- Filter: Advanced option. Optional. For more information, see Use Filter.
Click Add. After the trigger is added, it appears in the list.
- When a trigger pushes a blockchain event to an integrated service, a service processing error or parameter configuration error causes the trigger status to become Exception. You can move the pointer over Exception to view the error information.
- When the integrated service returns an exception, the trigger retries processing. If the retry fails multiple times, the trigger discards the event, which is counted as one failure. If the aggregate number of failure doesn’t exceed the failure threshold, the trigger pushes subsequent events. If the aggregate number of failure exceeds the failure threshold, the trigger enters the failed state and stops processing. You can repair the trigger or relevant service and enable it again, the failure number will return to zero.
Block heightfield indicates the latest block has been processed by the trigger, which reflects the progress of the trigger.
- After a trigger is created, you can perform the following operations:
- Delete: deletes the trigger.
- Disable: stops event pushes to the service for which you create the trigger.
- Enable: pushes events to the service for which you create the trigger. After a trigger is enabled, it pushes the events of the latest block. The events that are generated while the trigger is disabled are discarded.