Mule 3.5 has replaced All router with Scatter Gather. I have a need to send payload to more than one message routes . Its one way and no need to aggregate the response. How would that be possible? The documentation all seem to be about request/response and aggregating data.
You can simply add each one-way outbound endpoint in turn to your flow, like so:
<flow name="MyFlow">
<set-payload value="Important Message" />
<vm:outbound-endpoint path="vm.inbox" />
<jms:outbound-endpoint queue="jms.inbox" />
<jms:outbound-endpoint queue="jms.inbox2" />
</flow>
In this flow, the payload "Important Message" will be sent to one VM queue and two JMS queues, in parallel. The endpoints are one-way because VM and JMS transport are one-way by default.
Related
In simple http endpoint, how to implement load balancer using any point studio.
<flow name="testFlow">
<http:listener config-ref="HTTP_Listener_Configuration"/>
</flow>
In simple mule HTTP endpoint you cant achieve load balancing.
However there are other efficient solution for achieving load balancing in mule application.
https://docs.mulesoft.com/runtime-manager/dedicated-load-balancer-tutorial
http://www.slideshare.net/ramakrishnakapa/load-balancer-in-mule
Load balancing can not be in simple http endpoint, but you can deploy several instances of your application and balance your request among those instances in mule. Switching between those instances is matter of different algorithms.
In this post it is all described in detail.
https://blogs.mulesoft.com/dev/mule-dev/load-balancing-with-mule/
We have developed mule projects using AnyPoint Studio 6.1.0. We deploy these in cloudhub and access them using https urls. If it is POST method we pass JSON data and get the response. Here we are trying to provide security to the deployed app URLs so that end users must provide username and password to access these URLs.
Can anyone of you help us to implement security to Mule projects deployed to Cloudhub.For example, basic authentication security mechanism or any other ?
Mule uses Spring Security for authentication.
Detailed user guide: https://docs.mulesoft.com/mule-user-guide/v/3.8/configuring-the-spring-security-manager
This has an example of the http-security-filter that you need to put in the HTTP inbound endpoint.
Hope this helps
you need to use security manager to create a basic auth,Use the below spring beans in your mule configuration file.
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="user" password="password" authorities="ROLE_ADMIN" />
<ss:user name="anon" password="anon" authorities="ROLE_ANON" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="memory-provider" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
And after your http componenet add the basic auth
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<http:basic-security-filter realm="mule-realm"/>
I tried to use mule as simple http proxy but seeing cookies that are send from the actual endpoint server is not passed on to the the client. Mule response has only one cookie.
<flow name="HelloWorld" doc:name="HelloWorld">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8888" doc:name="Http Endpoint"/>
<http:outbound-endpoint
method="GET" exchange-pattern="request-response"
address="http://www.google.com"
contentType="text/html" doc:name="HTTP" />
</flow>
I think your problem is not passing the cookies to the client, but the fact that the cookies you receive will point to .google.com domain, so a basic web browser will probably reject them for security reasons when they come from localhost domain, and even if they were not rejected, they would not be sent along a subsequent call to localhost.
Now, the cookies come from the http outbound as a list that you can iterate and update with something like
#[foreach (cookie: message.inboundProperties['Set-Cookie']) {cookie.domain='localhost'}]
but you will also need to check for the existence of Set-Cookie property to not produce a null pointer exception when no cookies are set by the server.
for debugging your proxy app, you can/should also log the message you receive from the http outbound to see if cookies are present.
From the client/browser to the proxied server, I think the cookies should work just fine, as there is no domain data involved.
I need to support an operation both via SOAP and file dropping on a folder. Most of the logic will be he same. Is it possible to trigger the same flow with two message sources? I cant seem to find a way. Thanks
Use a composite message source:
<composite-source>
<file:inbound-endpoint ... />
<http:inbound-endpoint ... />
</composite-source>
If you use CXF, you'll have to stick the service element inside the HTTP inbound endpoint.
I'm new to Mule and am trying to setup a web server [in Mule] to "replace" an existing Java server - which simply proxies for a SOAP web service.
So:
Web client (js/html) requests a static resource
Mule Server must return the static resource
or
Web client uses Jquery Ajax (json) request with path starting with "api/"
Mule Server must forward the request to the Java server (to use the old API)
or
Web client uses Jquery Ajax request with path starting with "sapi/"
Mule Server must translate the request to XML and call the SOAP server (for new api calls)
I'm struggling to find a good starting point:
I've played with Ajax connectors (and end-points) and can get the static content served - but not sure where to go with the api calls (don't want to force the client app to use mule.js)
I've played with HTTP end points, and I can't get the static content served (implicit Content-Type issue)
Any help will be appreciated...
Use http:static-resource-handler to serve your static content: it should take care of the content types for you. See for more info: http://www.mulesoft.org/documentation/display/current/HTTP+Transport+Reference#HTTPTransportReference-ServingStaticContent%28sinceMule3.2%29
Forget about the Ajax connector, all you need is the HTTP connector. Bind one HTTP endpoint on api and the other on sapi.
When forwarding the request, be sure to propagate headers and, potentially, path extension after api/. See the example below to see how this is typically done.
<flow name="rawProxy">
<http:inbound-endpoint
address="http://localhost:${http.port}/rest-proxies/raw"
exchange-pattern="request-response" />
<copy-properties propertyName="*" />
<http:outbound-endpoint address="http://localhost:${http.port}/rest/#[message.inboundProperties['http.relative.path']]?#[message.inboundProperties['http.query.string']]"
exchange-pattern="request-response" />
<response>
<copy-properties propertyName="*" />
</response>
</flow>
If the SOAP API you're calling as a WSDL then generate a client for it and instead of transforming to XML, transform to the request object it expects.