NewJavaBee
NewJavaBee

Reputation: 53

read message from queue/topic in mule

I want to implement a consumer kind behaviour using Mule, ActiveMQ which can read JMS messages....there is some third party queue/topic. need to subscribe to them and start listening. How can I achieve that in mule?

Upvotes: 1

Views: 5030

Answers (2)

Víctor Romero
Víctor Romero

Reputation: 5115

Follow the instructions in this blog post to get a working connector. If you are using JMS1.1 you don't even need to specify queue or topic, they will behave the same. If you are using 1.0b, please make sure you specify the correct type.

Then, instead of using an outbound endpoint use an inbound endpoint:

<jms:inbound-endpoint topic="myTopic" connector-ref="Active_MQ" />

I do, however, recommend to use Anypoint Studio, that will provide you a very simple interface for this kind of configurations.

Upvotes: 2

Julio Cejas
Julio Cejas

Reputation: 573

To read a message from activemq queue ot topic, can simply put in your flow for example:

<flow name="insert-operation" doc:name="insert-operation" doc:description="">       
    <jms:inbound-endpoint connector-ref="Active_MQ" exchange-pattern="request-response" queue="insert-jms" doc:name="JMS">
        <idempotent-redelivery-policy idExpression="#[message.inboundProperties['JMSMessageID']]" />
        <xa-transaction action="ALWAYS_BEGIN" />
    </jms:inbound-endpoint>
...
</flow>

Upvotes: 1

Related Questions