Thiru
Thiru

Reputation: 424

How to check whether Active MQ is up in continuous intervals in mule esb?

I have message in one queue and need to send to other queue(destination) both are active MQs. When destination is down message will be in source Queue. I need to check in continuous intervals whether destination is up r not. if it is up I need to send to destination. I'm facing difficulty in checking the destination availability.., please help me., Thanks..,

Upvotes: 0

Views: 114

Answers (1)

Ryan Hoegg
Ryan Hoegg

Reputation: 2475

I think in general, this kind of problem is best solved using transactions.

I'm assuming you are working with two different ActiveMQ brokers, which leads to the chance that the destination queue is not available.

In the simplest case, you could accomplish your goal this way:

  1. Start JMS Transaction
  2. Receive message from queue A on broker 1
  3. Do any required logic and/or transformation
  4. Publish message to queue B on broker 2
  5. If successful, commit your JMS transaction
    • If not, rollback your JMS transaction

Example:

<flow name="simpleExample">
    <jms:inbound-endpoint queue="queueA" connector-ref="broker1">
        <jms:transaction action="ALWAYS_BEGIN"/>
    </jms:inbound-endpoint>
    <flow-ref name="doLogic" />
    <jms:outbound-endpoint queue="queueB" connector-ref="broker2">
        <jms:transaction action="ALWAYS_JOIN" />
    </jms:outbound-endpoint>
</flow>

When the rollback occurs, this method will immediately retry. If you want to control how long to wait before trying again, configure the redelivery policy on the ActiveMQ connector for Broker 1.

Upvotes: 2

Related Questions