SlideShare uma empresa Scribd logo
1 de 7
Baixar para ler offline
Como criar um HTTP proxy dinamico com Mule –
Parte 2
As razões para armazenar essa informação de uma classe de feijão
dedicado é para tornar mais fácil estender a classe com a
informação adicional, para facilitar a migração de armazenamento
numa base de dados e para manter os diferentes tipos de dados
armazenados no contexto de mula a um mínimo.
Configuração Mule HTTP proxy dinamico
A configuração Mule dinâmica proxy HTTP é implementado como
segue:
<?xml version="1.0" encoding="UTF-8"?>
<!--
The dynamic HTTP proxy Mule configuration file.
Author: Ivan Krizsan
-->
<mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripti
ng"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation
"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:test="http://www.mulesoft.org/schema/mule/test"
version="CE-3.4.0"
xsi:schemaLocation="http://www.springframework.org/schema/be
ans http://www.springframework.org/schema/beans/spring-beans-cu
rrent.xsd
http://www.springframework.org/schema/util http://www.springframe
work.org/schema/util/spring-util-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/
schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/s
chema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/s
chema/mule/test/current/mule-test.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.
org/schema/mule/scripting/current/mule-scripting.xsd">
<spring:beans>
<!--
Mappings from path to server represented by a hash map.
A map has been choosen to limit the scope of this example.
Storing data about mappings between path to server in a dat
abase
will enable runtime modifications to the mapping data without
having to stop and restart the general proxy Mule application
.
-->
<util:map id="pathToServerAndPortMapping" map-class="java.
util.HashMap">
<!-- Entry for MyServer. -->
<spring:entry key="services/GreetingService">
<spring:bean class="com.ivan.mule.dynamichttpproxy.Ser
verInformationBean">
<spring:constructor-arg value="localhost"/>
<spring:constructor-arg value="8182"/>
<spring:constructor-arg value="MyServer"/>
</spring:bean>
</spring:entry>
<!-- Entry for SomeOtherServer. -->
<spring:entry key="services/GreetingService?wsdl">
<spring:bean class="com.ivan.mule.dynamichttpproxy.Ser
verInformationBean">
<spring:constructor-arg value="127.0.0.1"/>
<spring:constructor-arg value="8182"/>
<spring:constructor-arg value="SomeOtherServer"/>
</spring:bean>
</spring:entry>
</util:map>
</spring:beans>
<flow name="HTTPGeneralProxyFlow">
<!--
Note that if you increase the length of the path to, for instanc
e
generalProxy/additionalPath, then the expression determinin
g
the outgoing path need to be modified accordingly.
Changing the path, without changing its length, require no
modification to outgoing path.
-->
<http:inbound-endpoint
exchange-pattern="request-response"
host="localhost"
port="8981"
path="dynamicHttpProxy" doc:name="HTTP Receiver"/>
<!-- Extract outgoing path from received HTTP request. -->
<set-property
value="#[org.mule.util.StringUtils.substringAfter(org.mule.util.
StringUtils.substringAfter(message.inboundProperties['http.request'],
'/'), '/')]"
propertyName="outboundPath"
doc:name="Extract Outbound Path From Request" />
<logger message="#[string:Outbound path = #[message.outbo
undProperties['outboundPath']]]" level="DEBUG"/>
<!--
Using the HTTP request path, select which server to forward
the request to.
Note that there should be some kind of error handling in cas
e there is no server for the current path.
Error handling has been omitted in this example.
-->
<enricher target="#[variable:outboundServer]">
<scripting:component doc:name="Groovy">
<!--
If storing mapping data in a database, this Groovy script
should be replaced with a database query.
-->
<scripting:script engine="Groovy">
<![CDATA[
def theMap = muleContext.getRegistry().lookupObjec
t("pathToServerAndPortMapping")
def String theOutboundPath = message.getOutbound
Property("outboundPath")
def theServerBean = theMap[theOutboundPath]
theServerBean
]]>
</scripting:script>
</scripting:component>
</enricher>
<logger
message="#[string:Server address = #[groovy:message.getI
nvocationProperty('outboundServer').serverAddress]]"
level="DEBUG"/>
<logger
message="#[string:Server port = #[groovy:message.getInvoc
ationProperty('outboundServer').serverPort]]"
level="DEBUG"/>
<logger
message="#[string:Server name = #[groovy:message.getInv
ocationProperty('outboundServer').serverName]]"
level="DEBUG"/>
<!-- Log the request and its metadata for development purpose
s, -->
<test:component logMessageDetails="true"/>
<!--
Cannot use a MEL expression in the value of the method attr
ibute
on the HTTP outbound endpoints so have to revert to this wa
y of
selecting HTTP method in the outgoing request.
In this example, only support for GET and POST has been i
mplemented.
This can of course easily be extended to support additional
HTTP
verbs as desired.
-->
<choice doc:name="Choice">
<!-- Forward HTTP GET requests. -->
<when expression="#[message.inboundProperties['http.meth
od']=='GET']">
<http:outbound-endpoint
exchange-pattern="request-response"
host="#[groovy:message.getInvocationProperty('outbou
ndServer').serverAddress]"
port="#[groovy:message.getInvocationProperty('outbou
ndServer').serverPort]"
method="GET"
path="#[message.outboundProperties['outboundPath']]"
doc:name="Send HTTP GET"/>
</when>
<!-- Forward HTTP POST requests. -->
<when expression="#[message.inboundProperties['http.meth
od']=='POST']">
<http:outbound-endpoint
exchange-pattern="request-response"
host="#[groovy:message.getInvocationProperty('outbou
ndServer').serverAddress]"
port="#[groovy:message.getInvocationProperty('outbou
ndServer').serverPort]"
method="POST"
path="#[message.outboundProperties['outboundPath']]"
doc:name="Send HTTP POST"/>
</when>
<!-- If HTTP method not recognized, use GET. -->
<otherwise>
<http:outbound-endpoint
exchange-pattern="request-response"
host="#[groovy:message.getInvocationProperty('outbou
ndServer').serverAddress]"
port="#[groovy:message.getInvocationProperty('outbou
ndServer').serverPort]"
method="GET"
path="#[message.outboundProperties['outboundPath']]"
doc:name="Default: Send HTTP GET"/>
</otherwise>
</choice>
</flow>
</mule>

Mais conteúdo relacionado

Mais de Jeison Barros

Transformando eficientemente resultados de uma consulta jdbc para json
Transformando eficientemente resultados de uma consulta jdbc para jsonTransformando eficientemente resultados de uma consulta jdbc para json
Transformando eficientemente resultados de uma consulta jdbc para jsonJeison Barros
 
Como criar um http proxy dinamico com mule parte 3
Como criar um http proxy dinamico com mule   parte 3Como criar um http proxy dinamico com mule   parte 3
Como criar um http proxy dinamico com mule parte 3Jeison Barros
 
Como criar um http proxy dinamico com mule parte 1
Como criar um http proxy dinamico com mule   parte 1Como criar um http proxy dinamico com mule   parte 1
Como criar um http proxy dinamico com mule parte 1Jeison Barros
 
Conectando seu banco de dados usando jdbc
Conectando seu banco de dados usando jdbcConectando seu banco de dados usando jdbc
Conectando seu banco de dados usando jdbcJeison Barros
 
Habilidades necessárias para integrar aplicativos e dados
Habilidades necessárias para integrar aplicativos e dadosHabilidades necessárias para integrar aplicativos e dados
Habilidades necessárias para integrar aplicativos e dadosJeison Barros
 
Qual integration framework você deve usar parte 2
Qual integration framework você deve usar parte 2Qual integration framework você deve usar parte 2
Qual integration framework você deve usar parte 2Jeison Barros
 
Qual integration framework você deve usar parte 1
Qual integration framework você deve usar parte 1Qual integration framework você deve usar parte 1
Qual integration framework você deve usar parte 1Jeison Barros
 
Consumindo soap wsdl
Consumindo soap wsdlConsumindo soap wsdl
Consumindo soap wsdlJeison Barros
 
Trabalhando com anexos soap usando módulo cxf do mule
Trabalhando com anexos soap usando módulo cxf do muleTrabalhando com anexos soap usando módulo cxf do mule
Trabalhando com anexos soap usando módulo cxf do muleJeison Barros
 
Começando com mulesoft e maven
Começando com mulesoft e mavenComeçando com mulesoft e maven
Começando com mulesoft e mavenJeison Barros
 
Estudo de caso: Mule como um transporte JMS Comum
Estudo de caso: Mule como um transporte JMS ComumEstudo de caso: Mule como um transporte JMS Comum
Estudo de caso: Mule como um transporte JMS ComumJeison Barros
 
Mule esb com framework cucumber part 1
Mule esb com framework cucumber part 1Mule esb com framework cucumber part 1
Mule esb com framework cucumber part 1Jeison Barros
 
Mule esb com framework cucumber part 2
Mule esb com framework cucumber part 2Mule esb com framework cucumber part 2
Mule esb com framework cucumber part 2Jeison Barros
 
Explorando mule esb sftp adapter
Explorando mule esb sftp adapterExplorando mule esb sftp adapter
Explorando mule esb sftp adapterJeison Barros
 
Fluxo dinâmicos usando spring aplication
Fluxo dinâmicos usando spring aplicationFluxo dinâmicos usando spring aplication
Fluxo dinâmicos usando spring aplicationJeison Barros
 
Data mapping com Groovy - Part 2
Data mapping com Groovy - Part 2Data mapping com Groovy - Part 2
Data mapping com Groovy - Part 2Jeison Barros
 
Relatório analytics de mula tempo de execução usando splunk
Relatório analytics de mula tempo de execução usando splunkRelatório analytics de mula tempo de execução usando splunk
Relatório analytics de mula tempo de execução usando splunkJeison Barros
 
Substituindo o request message no mule
Substituindo o request message no muleSubstituindo o request message no mule
Substituindo o request message no muleJeison Barros
 
Mule esb teste parte 2
Mule esb teste   parte 2Mule esb teste   parte 2
Mule esb teste parte 2Jeison Barros
 

Mais de Jeison Barros (20)

Transformando eficientemente resultados de uma consulta jdbc para json
Transformando eficientemente resultados de uma consulta jdbc para jsonTransformando eficientemente resultados de uma consulta jdbc para json
Transformando eficientemente resultados de uma consulta jdbc para json
 
Como criar um http proxy dinamico com mule parte 3
Como criar um http proxy dinamico com mule   parte 3Como criar um http proxy dinamico com mule   parte 3
Como criar um http proxy dinamico com mule parte 3
 
Como criar um http proxy dinamico com mule parte 1
Como criar um http proxy dinamico com mule   parte 1Como criar um http proxy dinamico com mule   parte 1
Como criar um http proxy dinamico com mule parte 1
 
Rest api vs SOAP
Rest api vs SOAPRest api vs SOAP
Rest api vs SOAP
 
Conectando seu banco de dados usando jdbc
Conectando seu banco de dados usando jdbcConectando seu banco de dados usando jdbc
Conectando seu banco de dados usando jdbc
 
Habilidades necessárias para integrar aplicativos e dados
Habilidades necessárias para integrar aplicativos e dadosHabilidades necessárias para integrar aplicativos e dados
Habilidades necessárias para integrar aplicativos e dados
 
Qual integration framework você deve usar parte 2
Qual integration framework você deve usar parte 2Qual integration framework você deve usar parte 2
Qual integration framework você deve usar parte 2
 
Qual integration framework você deve usar parte 1
Qual integration framework você deve usar parte 1Qual integration framework você deve usar parte 1
Qual integration framework você deve usar parte 1
 
Consumindo soap wsdl
Consumindo soap wsdlConsumindo soap wsdl
Consumindo soap wsdl
 
Trabalhando com anexos soap usando módulo cxf do mule
Trabalhando com anexos soap usando módulo cxf do muleTrabalhando com anexos soap usando módulo cxf do mule
Trabalhando com anexos soap usando módulo cxf do mule
 
Começando com mulesoft e maven
Começando com mulesoft e mavenComeçando com mulesoft e maven
Começando com mulesoft e maven
 
Estudo de caso: Mule como um transporte JMS Comum
Estudo de caso: Mule como um transporte JMS ComumEstudo de caso: Mule como um transporte JMS Comum
Estudo de caso: Mule como um transporte JMS Comum
 
Mule esb com framework cucumber part 1
Mule esb com framework cucumber part 1Mule esb com framework cucumber part 1
Mule esb com framework cucumber part 1
 
Mule esb com framework cucumber part 2
Mule esb com framework cucumber part 2Mule esb com framework cucumber part 2
Mule esb com framework cucumber part 2
 
Explorando mule esb sftp adapter
Explorando mule esb sftp adapterExplorando mule esb sftp adapter
Explorando mule esb sftp adapter
 
Fluxo dinâmicos usando spring aplication
Fluxo dinâmicos usando spring aplicationFluxo dinâmicos usando spring aplication
Fluxo dinâmicos usando spring aplication
 
Data mapping com Groovy - Part 2
Data mapping com Groovy - Part 2Data mapping com Groovy - Part 2
Data mapping com Groovy - Part 2
 
Relatório analytics de mula tempo de execução usando splunk
Relatório analytics de mula tempo de execução usando splunkRelatório analytics de mula tempo de execução usando splunk
Relatório analytics de mula tempo de execução usando splunk
 
Substituindo o request message no mule
Substituindo o request message no muleSubstituindo o request message no mule
Substituindo o request message no mule
 
Mule esb teste parte 2
Mule esb teste   parte 2Mule esb teste   parte 2
Mule esb teste parte 2
 

Último

'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...APNIC
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.soniya singh
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...tanu pandey
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...singhpriety023
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLimonikaupta
 

Último (20)

Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
'Future Evolution of the Internet' delivered by Geoff Huston at Everything Op...
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 

Como criar um http proxy dinamico com mule parte 2

  • 1. Como criar um HTTP proxy dinamico com Mule – Parte 2 As razões para armazenar essa informação de uma classe de feijão dedicado é para tornar mais fácil estender a classe com a informação adicional, para facilitar a migração de armazenamento numa base de dados e para manter os diferentes tipos de dados armazenados no contexto de mula a um mínimo. Configuração Mule HTTP proxy dinamico A configuração Mule dinâmica proxy HTTP é implementado como segue: <?xml version="1.0" encoding="UTF-8"?> <!-- The dynamic HTTP proxy Mule configuration file. Author: Ivan Krizsan --> <mule xmlns:scripting="http://www.mulesoft.org/schema/mule/scripti ng" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation " xmlns:spring="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:test="http://www.mulesoft.org/schema/mule/test" version="CE-3.4.0" xsi:schemaLocation="http://www.springframework.org/schema/be ans http://www.springframework.org/schema/beans/spring-beans-cu rrent.xsd http://www.springframework.org/schema/util http://www.springframe work.org/schema/util/spring-util-current.xsd
  • 2. http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/ schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/s chema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/test http://www.mulesoft.org/s chema/mule/test/current/mule-test.xsd http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft. org/schema/mule/scripting/current/mule-scripting.xsd"> <spring:beans> <!-- Mappings from path to server represented by a hash map. A map has been choosen to limit the scope of this example. Storing data about mappings between path to server in a dat abase will enable runtime modifications to the mapping data without having to stop and restart the general proxy Mule application . --> <util:map id="pathToServerAndPortMapping" map-class="java. util.HashMap"> <!-- Entry for MyServer. --> <spring:entry key="services/GreetingService"> <spring:bean class="com.ivan.mule.dynamichttpproxy.Ser verInformationBean"> <spring:constructor-arg value="localhost"/> <spring:constructor-arg value="8182"/> <spring:constructor-arg value="MyServer"/> </spring:bean> </spring:entry> <!-- Entry for SomeOtherServer. --> <spring:entry key="services/GreetingService?wsdl">
  • 3. <spring:bean class="com.ivan.mule.dynamichttpproxy.Ser verInformationBean"> <spring:constructor-arg value="127.0.0.1"/> <spring:constructor-arg value="8182"/> <spring:constructor-arg value="SomeOtherServer"/> </spring:bean> </spring:entry> </util:map> </spring:beans> <flow name="HTTPGeneralProxyFlow"> <!-- Note that if you increase the length of the path to, for instanc e generalProxy/additionalPath, then the expression determinin g the outgoing path need to be modified accordingly. Changing the path, without changing its length, require no modification to outgoing path. --> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8981" path="dynamicHttpProxy" doc:name="HTTP Receiver"/> <!-- Extract outgoing path from received HTTP request. --> <set-property value="#[org.mule.util.StringUtils.substringAfter(org.mule.util. StringUtils.substringAfter(message.inboundProperties['http.request'], '/'), '/')]"
  • 4. propertyName="outboundPath" doc:name="Extract Outbound Path From Request" /> <logger message="#[string:Outbound path = #[message.outbo undProperties['outboundPath']]]" level="DEBUG"/> <!-- Using the HTTP request path, select which server to forward the request to. Note that there should be some kind of error handling in cas e there is no server for the current path. Error handling has been omitted in this example. --> <enricher target="#[variable:outboundServer]"> <scripting:component doc:name="Groovy"> <!-- If storing mapping data in a database, this Groovy script should be replaced with a database query. --> <scripting:script engine="Groovy"> <![CDATA[ def theMap = muleContext.getRegistry().lookupObjec t("pathToServerAndPortMapping") def String theOutboundPath = message.getOutbound Property("outboundPath") def theServerBean = theMap[theOutboundPath] theServerBean ]]> </scripting:script> </scripting:component> </enricher>
  • 5. <logger message="#[string:Server address = #[groovy:message.getI nvocationProperty('outboundServer').serverAddress]]" level="DEBUG"/> <logger message="#[string:Server port = #[groovy:message.getInvoc ationProperty('outboundServer').serverPort]]" level="DEBUG"/> <logger message="#[string:Server name = #[groovy:message.getInv ocationProperty('outboundServer').serverName]]" level="DEBUG"/> <!-- Log the request and its metadata for development purpose s, --> <test:component logMessageDetails="true"/> <!-- Cannot use a MEL expression in the value of the method attr ibute on the HTTP outbound endpoints so have to revert to this wa y of selecting HTTP method in the outgoing request. In this example, only support for GET and POST has been i mplemented. This can of course easily be extended to support additional HTTP verbs as desired. --> <choice doc:name="Choice"> <!-- Forward HTTP GET requests. -->
  • 6. <when expression="#[message.inboundProperties['http.meth od']=='GET']"> <http:outbound-endpoint exchange-pattern="request-response" host="#[groovy:message.getInvocationProperty('outbou ndServer').serverAddress]" port="#[groovy:message.getInvocationProperty('outbou ndServer').serverPort]" method="GET" path="#[message.outboundProperties['outboundPath']]" doc:name="Send HTTP GET"/> </when> <!-- Forward HTTP POST requests. --> <when expression="#[message.inboundProperties['http.meth od']=='POST']"> <http:outbound-endpoint exchange-pattern="request-response" host="#[groovy:message.getInvocationProperty('outbou ndServer').serverAddress]" port="#[groovy:message.getInvocationProperty('outbou ndServer').serverPort]" method="POST" path="#[message.outboundProperties['outboundPath']]" doc:name="Send HTTP POST"/> </when> <!-- If HTTP method not recognized, use GET. --> <otherwise> <http:outbound-endpoint exchange-pattern="request-response" host="#[groovy:message.getInvocationProperty('outbou ndServer').serverAddress]"