Multiple Inboud Endpoints in Mule ESB Flow? - mule

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.

Related

how to implement load balancer in mule Http Endpoint

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/

How to Override Implementation of HTTP Outbound Connector in Mule AnyPoint Studio

Hi I am working with a Mule Any Point Studio and I just want to know that how to configure or override HTTP Inbound/Outbound Implementation so that i can dynamically override its functionality and change it's properties like :
Address
Exchange Patterns etc
Address is configurable and can be overridden dynamically but Exchange Patterns I guess cannot be dynamically changed...
You can put the values in a properties file and and load the http inbound address dynamically in following way :-
<http:inbound-endpoint exchange-pattern="request-response" address="http://${host}:${port}/${path}" doc:name="HTTP"/>
where ${host} ${port} ${path} are configured in properties file
You can also do the same for outbound
To decide the endpoint details (such as path, host and port) dynamically i.e. at runtime, you will need to execute an expression on the current Mule message for example. See the following link section "Dynamic endpoints" for examples: http://www.mulesoft.org/documentation/display/current/Endpoint+Configuration+Reference
you can extend the connector nature using the service overrides concept.
can search on mule documentation for service overrides.

How to pass values to SOAP service using web service consumer?

Hello i have an soap service , in which a method will receive 2 input values and gives a bool O/P.
i am using web service consumer endpoint to consume this soap service. i want to understand what is the way i can send values to SOAP service .
`<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="http://.....?singleWsdl" service="ClientService" port="WSHttpBinding_IClientService" serviceAddress="http://....../ClientService.svc" doc:name="Web Service Consumer"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="AuthenticateUser" doc:name="Web Service Consumer"/>
The web service consumer is very tipically used in conjunction with DataMapper, with it datamapper can pretty much visually construct a request for you. Given that DataMapper is an EE feature and you don't mention you have a license I suggest you changing approach and rather use the CXF module.
Based of the web service consumer documentation, the consumer is expecting the xml request of the service operation.
My quick suggestion is to use any tool to build the xml request based on the wsdl (such as SOAP UI) and use it in a set-payload, using MEL expressions to inject the two parameter values.
Hope it helps.
Please go through to get a better understanding on ws:consumer :- http://www.mulesoft.org/documentation/display/current/Web+Service+Consumer+Reference and http://www.mulesoft.org/documentation/display/current/Web+Service+Consumer
also there is an example in github:- https://github.com/mulesoft/mule-tooling-examples/blob/master/web-service-consumer/src/main/app/tshirt-service-consumer.xml
You can use <stdio:inbound-endpoint system="IN" doc:name="STDIO"/> to pass values to the service .. But I am not sure if it is a recommended approach ..
Another option is set-payload you can try to pass the value to the service
You can try this with this example
<ws:consumer-config name="Web_Service_Consumer"
wsdlLocation="somelocation_1.0.wsdl"
service="GreeterResponderService" port="GreeterResponderPort"
serviceAddress="http://user:password#localhost:8088/mockbinding"
doc:name="Web Service Consumer"/>

Scatter Gather for One Way

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.

Setup Mule web server and REST to SOAP proxy

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.