Skip to content

Instantly share code, notes, and snippets.

View ddossot's full-sized avatar
:shipit:
s̴̝̺̫͖̞͛̑͆̀̽̕ḩ̵͌̀͘í̴̝̰͉̒́̐͗p̶̯͍͎͒̿́̈́̕

David Dossot ddossot

:shipit:
s̴̝̺̫͖̞͛̑͆̀̽̕ḩ̵͌̀͘í̴̝̰͉̒́̐͗p̶̯͍͎͒̿́̈́̕
View GitHub Profile
$ time for (( i = 0 ; i < 10; i++ )); do curl -d "msg$i" http://localhost:9500/throttler ; done
real 0m0.310s
user 0m0.052s
package org.mule;
import org.mule.api.MuleEventContext;
import code.lucamarrocco.hoptoad.HoptoadNotice;
import code.lucamarrocco.hoptoad.HoptoadNotifier;
public class HoptoadExceptionStrategy extends DefaultExceptionStrategy {
private final HoptoadNotifier hoptoadNotifier = new HoptoadNotifier();
private String apiKey;
package org.mule;
import java.util.HashMap;
import java.util.Map;
import org.mule.api.MuleEventContext;
import org.mule.api.MuleMessage;
import org.mule.api.MuleSession;
import org.mule.api.endpoint.EndpointURI;
import org.mule.api.service.Service;
<model name="critical-services">
<custom-exception-strategy class="org.mule.HoptoadExceptionStrategy">
<spring:property name="apiKey" value="${hoptoad.api.key}" />
<spring:property name="environmentName" value="${hoptoad.environment.name}" />
</custom-exception-strategy>
<service name="critical-service-1">
...
</service>
<service name="simple-jms-queue-requester">
<inbound>
<inbound-endpoint ref="request-jms-queue" responseTimeout="3000" />
</inbound>
<script:component>
<script:script engine="groovy">
<script:text>
eventContext.requestEvent("jms://${payload}", eventContext.timeout)
</script:text>
</script:script>
<service name="selecting-jms-queue-requester">
<inbound>
<inbound-endpoint ref="select-jms-queue" responseTimeout="3000" />
</inbound>
<script:component>
<script:script engine="groovy">
<script:text>
eventContext.requestEvent("jms://fixedQueue?selector=userId%3D%27${userId}%27",
eventContext.timeout)
</script:text>
<service name="ftp-file-requester">
<inbound>
<inbound-endpoint ref="select-ftp-file" responseTimeout="30000" />
</inbound>
<script:component>
<script:script engine="groovy">
<script:text>
def ftpEndpointBuilder = muleContext.registry.lookupEndpointFactory().getEndpointBuilder("ftp://${ftpHost}${ftpDirectory}")
ftpEndpointBuilder.filter = new org.mule.transport.file.filters.FilenameWildcardFilter(ftpFileName)
eventContext.requestEvent(ftpEndpointBuilder.buildInboundEndpoint(),
<service name="http-rsw-requester">
<inbound>
<inbound-endpoint ref="rsw-request" responseTimeout="5000" />
</inbound>
<http:rest-service-component httpMethod="GET"
serviceUrl="#[message:payload]" />
</service>
<file:endpoint name="files"
path="/mule/in"
moveToDirectory="/mule/taken" />
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2"
xmlns:http="http://www.mulesource.org/schema/mule/http/2.2"
xmlns:data-int="http://www.mulesoft.com/schema/mdi/data-int/2.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd
http://www.mulesoft.com/schema/mdi/data-int/2.2 http://www.mulesoft.com/schema/mdi/data-int/2.2/mule-module-data-int.xsd">