I have setup rabbitMQ and created application with http inbound.
<flow>
<http:inbound />
<amqp:outbound ../>
</flow>
the above flow works perfectly. but when i switch to https:inbound it get fails with error message 'invalid value in table'
<flow>
<https:inbound />
<amqp:outbound ../>
</flow>
For workaround, remove outbound property - LOCAL_CERTIFICATE before calling amqp.
This is a know issue however there is no public issue yet, just an internal one (I´m the official maintainer).
This will be fixed as soon as possible.
Related
I build spring application and send to RabbitMQ.
now I want to build project in Mule ESB that listen to queue and work with the information, if has variable a (for example) -> process to aa flow etc..., -> convert responses to JSON -> send back to RabbitMQ. -
1) It will need to be RabbitMQ or other it possible?
2) How to do that - listen to specific queue and process it?
3) And after, how to send back?
I saw some examples but didn't understand the topic perfect.
`*
</amqp:queue-profile> -->
<flow name="amqpChoiceAckNackService">
<amqp:inbound-endpoint queueName="my-queue"
connector-ref="amqpManualAckLocalhostConnector" />
<http:inbound-endpoint exchange-pattern="one-way" host="localhost" port="8080" path="message" doc:name="HTTP"/>
<set-payload value="#[message.inboundProperties['msg']]" doc:name="Set Payload"/>
<processor-chain doc:name="Processor Chain">
<amqp:outbound-endpoint queueName="test.queue1" responseTimeout="10000" doc:name="AMQP1" connector-ref="AMQP_Connector1"/>
<custom-processor class="CustomProcessor" doc:name="Custom Processor"/>
</processor-chain>
</flow>*`
Who can help me?
Thanks.
to listen to a queue in mule you need to have following configuration,(I am not familiar to amqp but this way also works)
<spring:bean id="rabbitMQconnectionFactory" class="RabbitMQconnectionFactoryClass">
<!--..whatever properties are required by this class (hint :- search how to make a rabbitMQ connection factory bean) -->
</spring:bean>
<jms:connector name="rabbitMQconnector" connectionFactory-ref="rabbitMQconnectionFactory" username="" password="" doc:name="JMS"/>
<flow name="flow1" doc:name="Flow1">
<jms:inbound-endpoint doc:name="JMS" connector-ref="rabbitMQconnector" queue="queueNameToListen"/>
</flow>
to verify if the code worked , put a message on the queue you want to listen and run the mule application, if that message gets consumed properly you will see the message as dequed and no pending messages.
hope this helps!
good luck!
The example you provided in your question will work just fine. You just need to add exchangeType="topic" to the endpoint component.
More info available in the AMQP connector guide below:
https://github.com/mulesoft/mule-transport-amqp/blob/master/GUIDE.md
Example flow:
<amqp:connector name="amqpConnector" host="${host}" port="${port}" username="${username}" password="${password}"/>
<amqp:endpoint name="myExchange" exchangeName="${exchangeName}" queueName="${topicName}" exchangeType="topic" exchangeAutoDelete="false" exchangeDurable="true" queueAutoDelete="false" queueDurable="true"connector-ref="amqpConnector"/>
<flow name="main">
<amqps:inbound-endpoint ref="myExchange"/>
<flow-ref name="doSomething"/>
<amqp:outbound-endpoint ref="myExchange"/>
</flow>
I work with Mule. And I have spring bean
<spring:bean id="`MyPropertiesSaver`" name="MyPropertiesSaver" class="MyPropertiesSaver">
<spring:property name="prop_name" value="${PROP_VALUE}"/>
</spring:bean>
Also I work with file in flow
<flow name="Handler" doc:name="Handler">
<file:inbound-endpoint `path="${PROP_VALUE}"` moveToPattern="#[header:originalFilename].txt" responseTimeout="10000" doc:name="File"/>
...
</flow>
So I get PROP_VALUE from system variables. I want to change path of file while programm is running. I change prop_name of class MyPropertiesSaver using MX4J. But path="${PROP_VALUE}" does not change. That's why I want to get prop_name from MyPropertiesSaver. Somthing like this
path="MyPropertiesSaver.prop_name"
How can I do that?
You need to extend the file message receiver to allow to externally set of the fileDir and disconnect-connect when this happens. Then in your connector use a service-override to use that customised message receiver.
Having a Dynamic Endpoint for File Inbound is not possible.
File Inbound should know where to look for when the flow is started.
If your usecase demands a dynamic file location and reading you can try the workaround with Mule Requester module.
Read throubh the following link for more details.
Unable to create dynamic file inbound endpoint in mule
Hope this helps.
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?
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.
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>
I'm still new to Spring Integration and I've few question.
I have a service with WSDL deploy in tomcat server.
and I would like to send parameter from my spring integration flow to that service and receive
response back to do next things in the flow.
I should use outbound WS gateway to do this right?
and how to config the xml to do this?
i've try temperature example but still don't understand it.
thank you.
///////////////////////////////////////////////////////////////
Here is my config:
<int:gateway service-interface="com.app.service.IRequester" id="IRequester"
default-request-channel="requestChannel"
default-reply-channel="responseChannel"
error-channel="errorChannel" >
</int:gateway>
<int:service-activator input-channel="requestChannel" id="bu1"
ref="BU1" method="bu1Method"
output-channel="buChannel">
</int:service-activator>
<int:service-activator input-channel="errorChannel"
ref="handlerError" method="errorReturnToGateway"
output-channel="responseChannel" >
</int:service-activator>
<int:router id="routingChannel" input-channel="buChannel" ref="RoutingChannel" method="routingChannel">
<int:mapping value="firstChannel" channel="channelFirst" />
<int:mapping value="otherChannel" channel="channelOther" />
</int:router>
<int:service-activator id="firstBU" input-channel="channelFirst"
ref="FirstBU" method="doSomething" output-channel="responseChannel">
</int:service-activator>
<int:service-activator id="otherBU" input-channel="channelOther"
ref="OtherBU" method="doSomething" output-channel="responseChannel">
</int:service-activator>
I need to change output channel from both firstBU and otherBU activator to call web service which is send a paremeter to that service(paremeter type is Hashmap) and receive same type response.
I don't know how to call web service by using ws:outbound-gateway.Since I have only known to call web service using java way by generate client java class and may be i'll call service in method doSomething.
In my case,Do you think which way is better?
And I still want to know how to solve this by use ws:outbound-gateway too.
thank you.
As far as it is SOAP, so you get deal with XML. And your WSDL provides you the contract - an XSD which XML should be sent to the service and which will be returned as a response.
So, your task to configure <int-ws:outbound-gateway> and provide correct XML as a message payload to the request-channel of that component.
The same is about a response: you get an XML as payload.
However, it is for simple WS Outbound Gateway. You can configure it with marshaller and send to the request-channel some domain POJO and that marshaller takes care about converting that POJO to the XML representation for the SOAP request.
Show, your config, please, and maybe we can help more with your concreate issues.
From Mule, I am trying to build a flow to read the messages from active MQ and send it to DB. So within my flow, I have a JMS inbound endpoint,followed by Java component, where I am making JDBC connections.Now my problem is , I want to implement a rollback which will try to rollback messages to Q if there is any connection problem on the backend.
This does seems to be working, but partially. So when there is an exception on the java component, I see messages are rolling back. But even after reaching maximum redelivery attempts, I do not see the block under section getting executed.
What type of transaction should I be using in this case.?
Please suggest how to fix this issue.
`
<jms:inbound-endpoint queue="TestQ"
connector-ref="ActiveMQ" doc:name="JMS" >
<ee:multi-transaction action="ALWAYS_BEGIN"></ee:multi-transaction>
</jms:inbound-endpoint>
<component class="com.test.JDBCComponent" doc:name="Java"/>
<rollback-exception-strategy
maxRedeliveryAttempts="3" doc:name="Rollback Exception Strategy">
<on-redelivery-attempts-exceeded
doc:name="Redelivery exhausted">
<logger message="EXHAUSTER REDILVERY" level="INFO" doc:name="Logger" />
</on-redelivery-attempts-exceeded>
</rollback-exception-strategy>
</flow>
`
It should work aditya , as if this is not working you can use untill - successful scope.
https://docs.mulesoft.com/mule-user-guide/v/3.5/until-successful-scope
<jms:activemq-connector name="Active_MQ"
brokerURL="tcp://localhost:61616" maxRedelivery="5" />
maxRedelivery attribute in the connector definition goes in conflict with maxRedeliveryAttempts of the roll-back strategy
The smallest wins..
As per the transaction looks correctly configured.