Requeue a message preserving the message order with a delay in case of error

This sample demonstrates how WSO2 Micro Integrator can ensure guaranteed delivery of messages by requeueing messages when an error occurs during delivery. That is, the Micro Integrator can be configured to requeue messages to a RabbitMQ queue when the delivery fails.

As shown in the following example, the Micro Integrator first consumes the request message from the RabbitMQ queue and sends it to the back-end HTTP endpoint. If the HTTP endpoint becomes unavailable, the message will be returned to the student-registration queue in the RabbitMQ broker until the endpoint becomes available again.

Synapse configurations

See the instructions on how to build and run this example.

<proxy xmlns=""
         <log level="custom">
            <property name="Message Received" expression="$body"/>
         <call blocking="true">
               <http uri-template="http://localhost:8280/students"/>
         <log level="custom">
            <property name="Status" value="The message process successfully"/>
         <log level="custom">
            <property name="Status" value="Could not process the message"/>
         <property name="SET_REQUEUE_ON_ROLLBACK" value="true" scope="axis2"/>
   <parameter name="">false</parameter>
   <parameter name="">1</parameter>
   <parameter name="rabbitmq.message.requeue.delay">30000</parameter>
   <parameter name="">student-registration</parameter>
   <parameter name="rabbitmq.connection.factory">AMQPConnectionFactory</parameter>

Build and run

  1. Set up WSO2 Integration Studio.
  2. Create an integration project with an ESB Configs module and an Composite Exporter.
  3. Create the proxy service with the configurations given above.
  4. Enable the RabbitMQ sender and receiver in the Micro-Integrator from the deployment.toml. Refer the configuring RabbitMQ documentation for more information.
  5. Deploy the artifacts in your Micro Integrator.
  6. Make the http://localhost:8280/students endpoint unavailable temporarily.
  7. Make sure you have a RabbitMQ broker instance running.
  8. Publish a message to the student-registration queue.