I am new to Mule ESB. Currently i am handling a project, where we are using Mule as message broker. Requirement is client will call a SOAP web service (request-response) published in Mule ESB. In the server request will be accepted and return a correlation id in the ws response to the client, but at the same time service will also put request payload in the JMS queue for async processing. The JMS queue is also maintained in the Same Mule ESB. Could you please help me how HTTP endpoint can push to JMS endpoint in Mule ESB?
This is very simple, if you want to put your soap request in a JMS queue along the call to the SOAP web service exposed in the Mule, then what you can do is after your HTTP listener in the flow, you need to put a Async block (reference :- https://docs.mulesoft.com/mule-user-guide/v/3.6/async-scope-reference) and in that Async block you can use Object to String Transformer followed by you JMS outbound end point.
This Async block block will create a separate thread from the flow and will push your SOAP request to the JMS queue along with your SOAP web service which accept the request and return a correlation id in the ws response to the client as you reuired.
Remember anything you put inside <async/> is considered as an async block and will used as a separate thread. You need to put this after your HTTP listener in the flow as mentioned above.
Related
is it possible to implement following concept with WSO2 ESB:
http listener for webservices with a method to be called (SOAP)
java routine to process message
same routine to put message to MQ queue Q1
same routine to get answer message from MQ queue Q2
return with processed answered message to webservice caller
or it's better to go with J2EE server and handle messaging part fully through java code?
Regards, Nikola
Well now usecase is much more clear so that we can go ahead and implement it. There are two ways of doing this.
First Approach
Write a Proxy(HTTP to JMS) service which accepts HTTP requests and
place it in JMS Q1 using the jms sender.
Then write another proxy (JMS to JMS), which picks the messages from
JMS Q1, process it and place it in JMS Q2.
Finally create another proxy (JMS to HTTP) to get the message from
JMS Q2 and send it back to the client using the respond mediator.
Second Approach
Create a proxy service (HTTP to JMS) and use store mediator to store the message into JMS Q1.
Create a Forwarding Message Processor to listen to Q1 and pick the message, process it, place it in Q2.
Then create another forwarding message processor to listen to Q2, and send it back to the client using a reply sequence in the message processor.
Choose which ever the way you like and let me know how it goes.
You can use ESB to implement this. But your usecase is not that clear to me. Appreciate if you can explain your usecase in functional perspective. Anyway you have HTTP(S)/JMS listeners and senders with ESB . You can't listen to a SOAP web service using ESB. What you can do is listen to HTTP traffic. Create a proxy that listens to HTTP traffic and send the message to JMS queue Q1 ussing JMS end point. Then write a JMS listener proxy to listen to the answers in Q2. Once it is received you can call the endpoint web service using send or call mediator. This is how I understood your usecase. I have no idea on transformation of data in Q1 and place it in to Q2 due to wired requirements specified above. It looks simple HTTP to JMS switching usecase to me.
I'm using WSO2 ESB 4.9.0 for backend service invocation using blocking call. I have to use blocking call because of jms transaction. Sometimes the network between ESB and backend service is slow so I want to use timeout on connection, but with blocking call timeout on endpoint doesn't work. With non-blocking call timeout works fine.
Is it possible to use timeout with blocking call?
Thanks for any tips.
As endpoint timeout not working in blocking call you can try out following two methods:
1) Global timeout defined in synapse.properties(ESB_HOME\repository\conf) file.
This will decide the maximum time that a callback is waiting in the ESB for a response for a particular request.
If ESB does not get any response from Back End, it will drop the message and clears out the call back. This is a global level parameter which affects all the endpoints configured in ESB.
synapse.global_timeout_interval=120000
2) Socket timeout defined in the passthru-http.properties (ESB_HOME\repository\conf) file.
This parameter will decide on the timeout which a particular http request is waiting for a response. If ESB does not receive any response from the Back End during this period, HTTP connection get timed out and that will eventually throws timeout error in the ESB side and fault handlers will be hit.
http.socket.timeout=60000
We can define blocking timeout at /repository/conf/axis2/axis2_blocking_client.xml by defining SO_TIMEOUT parameter for relevant TransportSender [1].
[1] - https://medium.com/#dilsimchandrasena/set-timeout-for-endpoints-when-call-mediator-blocking-true-fd2744b2cc19
I have a requirement where in (RabbitMQ)server sends the request to the client and client executes the operation and sends the response back to the server.
I would like to know which mechanism to use for this Topic, PubSub, Routing...
Can we create the bi-directional connection like server-client similar to xmpp in rabbit mq, if yes how can we do?
thanks
Lokesh
You can use a Spring AMQP asynchronous consumer with a MessageListenerAdapter to invoke a POJO. See the reference documentation.
If you want more control; use a simple MessageListener and send the reply with a RabbitTemplate.
This test case shows an end-to-end configuration (client side and server side). The client side automatically takes care of setting the correlationId.
I have WSO2 ESB and ELB instances installed.
When HTTP request comes to ESB, it opens a socket and waits for response.
But if ELB instantiates new ESB, then response can go to ESB #2 (instead of #1) and find that there is no socket connection. How would I route response to ESB #1?
[EDIT]
I have implemented custom Axis2 transport, which has class CustomTransportListener. There is a List of opened socket connections, which wait for response. This is the reason why only ESB #1 can handle response.
Each ESB in the ESB cluster behind the ELB is the same so it would not matter which ESB node in the cluster serves the request. The purpose of the ELB is to automatically balance the load and make it so that the complexities of the cluster is not seen so it does not provide a way to specify an specific node that should receive the response.
It is not possible to send a request to a specific ESB in the cluster through the ELB because the ELB uses an Round Robin algorithm to dispatch request to the ESB cluster so you can not gurantee that a specific ESB node will get the request. In my opinoin do not think it is a good idea to make the ESB's in the same cluster different from each other :).
I have a javascript client which invokes an asynchronous web service with the callback in apache tomcat server. Webservice places the request to xmpp server and returns. I have another receiver component which receives the message from the xmpp server process it and puts back the response in another xmpp receiver queue. Now I would like to know of by connecting Apache Camel to the receiver queue, how can I notify the client callback. Do we have any option in apache camel to do this.
Please let me know if you have any thoughts on this.
thanks
Lokesh