I wanted to know if we can configure multiple base path for a proxy endpoint in APIGEE. The target proxy remains same for both basepaths.
Example: I want to ensure /hello/world and /hello/universe route to same target endpoint and are treated in same way entirely
<HTTPProxyConnection>
<BasePath>world</BasePath>
<BasePath>universe</BasePath>
<VirtualHost>hello</VirtualHost>
</HTTPProxyConnection>
How to achieve the same?
The <VirtualHost> field should refer to an Apigee vhost, which is a Fully Qualified Domain Name ('FQDN'). That's a hostname like demo.api.company.com. E.g., everything before the first /.
Your proxy basepath is then /hello, like this:
<BasePath>hello</BasePath>
And then the rest of your API proxy definition uses flows and path-matching conditions to handle the different methods you want to operate at /hello/world vs /hello/universe
<Flow name="world_GET">
<Description>World GET</Description>
<Request>
<Step>
<Name>World01</Name>
</Step>
<Step>
<Name>World02</Name>
</Step>
</Request>
<Response/>
<Condition>((proxy.pathsuffix MatchesPath "/world") and (request.verb = "GET"))</Condition>
</Flow>
<Flow name="universe_GET">
<Description>Uni GET</Description>
<Request>
<Step>
<Name>Uni01</Name>
</Step>
<Step>
<Name>Uni02</Name>
</Step>
</Request>
<Response/>
<Condition>((proxy.pathsuffix MatchesPath "/universe") and (request.verb = "GET"))</Condition>
</Flow>
See:
https://docs.apigee.com/api-platform/reference/api-proxy-configuration-reference#proxyendpoint-proxyendpointconfigurationelements
Related
I saw that I can use different types of hostnames
<hostname physical="true"> technical_name </hostname>
<hostname default="true"> link </hostname>
<hostname> name </host>
can someone tell me which is the difference between these lines? and also what happens if I set physical or default hostname on false ?
This is my basic mule flow:
HTTP Listener > Logger > Http Request > Logger (Result message)
<http:request-config name="HTTP_Request_Configuration" host="localhost" port="8080" doc:name="HTTP Request Configuration" usePersistentConnections="false"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="servoy-restFlow">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/" doc:name="HTTP" />
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO"
doc:name="Logger" />
<http:request config-ref="HTTP_Request_Configuration"
path="service/rest/request" method="POST"
doc:name="HTTP" />
<logger message="#[message.payloadAs(java.lang.String)]" level="INFO"
doc:name="Logger" />
</flow>
But it returns an error about timeout exception:
********************************************************************************
Exception stack is:
1. Timeout exceeded (java.util.concurrent.TimeoutException)
com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider:426 (null)
2. Error sending HTTP request. Message payload is of type: String (org.mule.api.MessagingException)
org.mule.module.http.internal.request.DefaultHttpRequester:287 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
********************************************************************************
Root Exception stack trace:
java.util.concurrent.TimeoutException: Timeout exceeded
at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider.timeout(GrizzlyAsyncHttpProvider.java:426)
at com.ning.http.client.providers.grizzly.GrizzlyAsyncHttpProvider$3.onTimeout(GrizzlyAsyncHttpProvider.java:274)
at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:398)
at org.glassfish.grizzly.utils.IdleTimeoutFilter$DefaultWorker.doWork(IdleTimeoutFilter.java:377)
at org.glassfish.grizzly.utils.DelayedExecutor$DelayedRunnable.run(DelayedExecutor.java:158)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
********************************************************************************
What should I do to avoid the timeout?
The default timeout of http outbound request is 30 seconds specified in ms in mule. Increase timeout of http-request config to greater than 30 seconds, may be to start with 40 seconds and see what's your desired number.
<http:request-config responseTimeout="40000" .../>
Try increasing the timeout in:
<http:request-config responseTimeout="XYZ" />
Taking another approach to this problem...
Do you have an issue with the service you are trying to consume and it's not responding. I've always found the default timeout to be sufficient (even for calling external services).
You can set Timeout for your entire application configuring a global deafult timeout property at the beginning of your .xml, in example:
<configuration defaultTransactionTimeout="90000" defaultResponseTimeout="90000" doc:name="Configuration">
<default-threading-profile poolExhaustedAction="RUN"/>
</configuration>
I hope this helps.
Where you receive the POST request - maybe a method or microflow, there is actions that happen first and after that the POST is executed. If you cannot change the logic there and remove them, just increase the timeout in the request configuration in Mule.
I want to generate a lot of requests using TSUNG.
My configuration file is
<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="notice" dumptraffic="false" version="1.0">
<clients>
<client host="localhost" maxusers="70000" use_controller_vm="true"/>
</clients>
<servers>
<server host="myhost" port="5222" type="tcp"/>
</servers>
<load>
<arrivalphase phase="1" duration="70000" unit="second">
<users arrivalrate="10" unit="second"/>
</arrivalphase>
</load>
<options>
<option type="ts_jabber" name="global_number" value="70000"/>
<option type="ts_jabber" name="domain" value="my-domain"/>
<option name="file_server" id="userdb" value="/root/userdata.csv"/>
</options>
<sessions>
<session probability="100" name="xmpp-connection" type="ts_jabber" bidi="true" $
<setdynvars sourcetype="file" fileid="userdb" delimiter=";" order="iter">
<var name="userid"/>
</setdynvars>
<transaction name="initial_stream">
<request subst="true">
<jabber type="connect" ack="local">
<xmpp_authenticate username="tsung%%_userid%%" passwd="tsung%%_userid%%"/>
</jabber>
</request>
</transaction>
<thinktime value="2"/>
<transaction name="authenticate">
<request> <jabber type="auth_sasl" ack="local"/> </request>
<request> <jabber type="connect" ack="local"/> </request>
<request> <jabber type="auth_sasl_bind" ack="local"/> </request>
<request> <jabber type="auth_sasl_session" ack="local"/> </request>
</transaction>
<transaction name="roster_get">
<request> <jabber type="iq:roster:get" ack="local"/> </request>
</transaction>
<request> <jabber type="presence:initial" ack="no_ack"/> </request>
<for from="1" to="28" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<for from="1" to="30" incr="1" var="counter">
<request> <jabber type="raw" ack="no_ack" data="
"/></request>
<thinktime value="60" random="false"/>
</for>
<transaction name="close">
<request> <jabber type="close" ack="no_ack"/> </request>
</transaction>
</session>
</sessions>
</tsung>
As per the documentation of TSUNG, I can hit the server using multiple client ips (one machine)
http://tsung.erlang-projects.org/user_manual/conf-client-server.html
Several virtual IP can be used to simulate more machines. This is very useful when a load-balancer use the client’s IP to distribute the traffic among a cluster of servers.
<clients>
<client host="louxor" weight="1" maxusers="800">
<ip value="10.9.195.12"></ip>
<ip value="10.9.195.13"></ip>
</client>
<client host="memphis" weight="3" maxusers="600" cpu="2"/>
</clients>
I want to find out how many connections per one machine I can generate using TSUNG.
I have a 32 GB, 8 core machine.
This will depend on two factors:
The maximum number of simultaneously open Erlang ports.
The maximum amount of open file description in your operating system.
For information about the first one see open ports in the 10.2 System Limits section of the Advanced Erlang document. It can be changed using the +Q option when starting the Erlang VM. The default is 16384. And the current limit can be checked using erlang:system_info/1:
erlang:system_info(port_limit).
For second information simply ulimit -n in the shell. How to change this value depends on the operating system but it's a popular topic so you will easily be able to search for instructions.
I tried to do the tutorials suggested on the MuleSoft's website.
I first started with this example:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 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" version="EE-3.6.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-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/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8084" doc:name="HTTP Listener Configuration"/>
<flow name="basic_tutorialFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<expression-filter expression="#[payload != '/favicon.ico']" doc:name="Expression"/>
<logger level="INFO" doc:name="Logger" message="Current payload is #[payload]"/>
<set-payload doc:name="Set Payload" value="#['Hello, ' + message.inboundProperties.'http.request.path' + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]"/>
</flow>
</mule>
Which can be found here http://www.mulesoft.org/documentation/display/current/Basic+Studio+Tutorial
I made it using the drag and drop feature and after that I copied the code on the website just to be sure it wasn't my mistake.
When I enter the URL with no payload it works well. I get this response
Hello, /. Today is 23/01/15.
But when I add a payload like in the tutorial it doesn't work :
Resource not found.
I have tried other examples as well, as long as I don't enter a payload it works. Here is what the console tells me :
INFO 2015-01-23 10:33:55,614 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.api.processor.LoggerMessageProcessor: Current payload is {NullPayload}
INFO 2015-01-23 10:34:32,794 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: No listener found for request: (GET)/asd
INFO 2015-01-23 10:34:32,796 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: Available listeners are: [(*)/]
INFO 2015-01-23 10:34:36,205 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: No listener found for request: (GET)/world
INFO 2015-01-23 10:34:36,205 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: Available listeners are: [(*)/]
So basically the problem is :
INFO 2015-01-23 10:34:36,205 [[basic_tutorial].HTTP_Listener_Configuration.worker.01] org.mule.module.http.internal.listener.HttpListenerRegistry: No listener found for request: (GET)/world
So with 3.6, the HTTP connector has changed drastically. Here are some changes:
Previously, the HTTP connector would place the contents of the path inside your payload. Moreover, now you need to invoke paths as is. What I mean is that nowadays, if your endpoint is listening on http://localhost:8084/, that's where you need to send the request. Sending a request on http://localhost:8084/HelloWorld will NOT match.
Sending a GET request now will set your payload to NullPayload, which admittedly makes sense, since an HTTP GET does not have an HTTP body.
What I suggest is the following: have your endpoint listening on a path as follows:
<http:listener config-ref="HTTP_Listener_Configuration" path="/{name}" doc:name="HTTP"/>
Notice that I've added a placeholder variable called "name", you can change this to whatever you like. You can then access this placeholder as follows:
#[message.inboundProperties['http.uri.params']['name']]
You can use this expression to return some fancy string, as you're doing above:
<flow name="basic_tutorialFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/{name}" doc:name="HTTP"/>
<set-variable variableName="name" value="#[message.inboundProperties['http.uri.params']['name']]" />
<set-payload doc:name="Set Payload" value="#['Hello, ' + flowVars['name'] + '. Today is ' + server.dateTime.format('dd/MM/yy') + '.' ]"/>
</flow>
Cheers,
JS
As told before, the HTTP Connector is deeply changed from version 3.6 onward.
Now, the connector only listen to the specific path you explicitly define.
My issue was that I wasn't even able to get the WSDL by the obious http://localhost:8080/soap?wsdl.
So, the easiest solution I found to solve this issue was to allow the connector to accept all subpaths by ending the path with the wildcard '*'.
Change your project.xml as I show here:
<http:listener config-ref="HTTP_Listener_Configuration" path="/*" doc:name="HTTP"/>
and all subpaths will be processed.
What is an equivalent SWS call for the following host command:
PI/TRAVELER/823144910-1.1
I am trying to associate a guest profile with a guest on a PNR.
You also have the option to use SabreCommandLLSRQ to send the native PI/TRAVELER/823144910-1.1 command.
<SabreCommandLLSRQ xmlns="http://webservices.sabre.com/sabreXML/2003/07" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" EchoToken="String" TimeStamp="2001-12-17T09:30:47-05:00" Target="Production" Version="2003A.TsabreXML1.6.1" SequenceNmbr="1" PrimaryLangID="en-us" AltLangID="en-us">
<Request Output="SCREEN" CDATA="true">
<HostCommand>PI/TRAVELER/823144910-1.1</HostCommand>
</Request>
The only way to add a Profile Index (PI) to a PNR is to use the ProfileToPNR service that moves the profile into the PNR.